diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index a7f326bc79e..1aac9c0c0c2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -4993,7 +4993,9 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int len++; p++; while (*p && (*p != quote || escape)) { - escape = (*p == '\\'); + /* A pair of back-slashes represents a single back-slash, + * only use a single back-slash for escaping. */ + escape = (escape == 0) && (*p == '\\'); len++; p++; } @@ -5033,11 +5035,17 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int /* copy string, taking into account escaped ] */ if (bracket) { for (p = *path, i = 0, j = 0; i < len; i++, p++) { - if (*p == '\\' && ELEM(*(p + 1), quote, '\\')) { - } - else { - buf[j++] = *p; + if (*p == '\\') { + if (*(p + 1) == '\\') { + /* Un-escape pairs of back-slashes into a single back-slash. */ + p++; + i += 1; + } + else if (*(p + 1) == quote) { + continue; + } } + buf[j++] = *p; } buf[j] = 0; |