diff options
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index bade390d056..7103f8a7597 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -108,6 +108,8 @@ void BLI_cleanup_dir(const char *relabase, char *dir) ATTR_NONNULL(2); /* doesn't touch trailing slash */ void BLI_cleanup_path(const char *relabase, char *path) ATTR_NONNULL(2); +void BLI_filename_make_safe(char *fname) ATTR_NONNULL(1); + /* go back one directory */ bool BLI_parent_dir(char *path) ATTR_NONNULL(); @@ -163,6 +165,15 @@ void BLI_string_to_utf8(char *original, char *utf_8, const char *code); # define FILE_MAX 1024 #endif +/* Parent and current dir helpers. */ +#define FILENAME_PARENT ".." +#define FILENAME_CURRENT "." + +/* Avoid calling strcmp on one or two chars! */ +#define FILENAME_IS_PARENT(_n) (((_n)[0] == '.') && ((_n)[1] == '.') && ((_n)[2] == '\0')) +#define FILENAME_IS_CURRENT(_n) (((_n)[0] == '.') && ((_n)[1] == '\0')) +#define FILENAME_IS_CURRPAR(_n) (((_n)[0] == '.') && (((_n)[1] == '\0') || (((_n)[1] == '.') && ((_n)[2] == '\0')))) + #ifdef __cplusplus } #endif |