diff options
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index c824def9104..958480cc616 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -245,12 +245,19 @@ void BLI_path_normalize_dir(const char *relabase, char *dir) BLI_path_slash_ensure(dir); } -bool BLI_filename_make_safe(char *fname) +bool BLI_filename_make_safe_ex(char *fname, bool allow_tokens) { - const char *invalid = - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" - "/\\?*:|\"<>"; +#define INVALID_CHARS \ + "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" \ + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f" \ + "/\\?*:|\"" +#define INVALID_TOKENS "<>" + + const char *invalid = allow_tokens ? INVALID_CHARS : INVALID_CHARS INVALID_TOKENS; + +#undef INVALID_CHARS +#undef INVALID_TOKENS + char *fn; bool changed = false; @@ -315,6 +322,11 @@ bool BLI_filename_make_safe(char *fname) return changed; } +bool BLI_filename_make_safe(char *fname) +{ + return BLI_filename_make_safe_ex(fname, false); +} + bool BLI_path_make_safe(char *path) { /* Simply apply BLI_filename_make_safe() over each component of the path. |