diff options
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 658cc0c3825..8881983fbec 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -49,7 +49,7 @@ void BLI_setenv_if_new(const char *env, const char *val) ATTR_NONNULL(1); * This function uses an alternative method to get environment variables that does pick up on * runtime environment variables. The result will be UTF-8 encoded. */ -const char *BLI_getenv(const char *env) ATTR_NONNULL(1); +const char *BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT; /** * Returns in `string` the concatenation of `dir` and `file` (also with `relabase` on the @@ -337,13 +337,13 @@ void BLI_path_frame_strip(char *path, char *r_ext) ATTR_NONNULL(); /** * Check if we have '#' chars, usable for #BLI_path_frame, #BLI_path_frame_range */ -bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL(); +bool BLI_path_frame_check_chars(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT; /** * Checks for a relative path (ignoring Blender's "//") prefix * (unlike `!BLI_path_is_rel(path)`). * When false, #BLI_path_abs_from_cwd would expand the absolute path. */ -bool BLI_path_is_abs_from_cwd(const char *path) ATTR_NONNULL(); +bool BLI_path_is_abs_from_cwd(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT; /** * Checks for relative path, expanding them relative to the current working directory. * \returns true if the expansion was performed. @@ -367,7 +367,7 @@ bool BLI_path_is_rel(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; /** * Return true if the path is a UNC share. */ -bool BLI_path_is_unc(const char *path); +bool BLI_path_is_unc(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT; /** * Creates a display string from path to be used menus and the user interface. @@ -404,6 +404,20 @@ bool BLI_path_suffix(char *string, size_t maxlen, const char *suffix, const char # define BLI_path_ncmp strncmp #endif +/** + * Returns the result of #BLI_path_cmp with both paths normalized and slashes made native. + * + * \note #BLI_path_cmp is used for Blender's internal logic to consider paths to be the same + * #BLI_path_cmp_normalized may be used in when handling other kinds of paths + * (e.g. importers/exporters) but should be used consistently. + * + * Checking the normalized paths is not a guarantee the paths reference different files. + * An equivalent to Python's `os.path.samefile` could be supported for checking if paths + * point to the same location on the file-system (following symbolic-links). + */ +int BLI_path_cmp_normalized(const char *p1, const char *p2) + ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; + /* These values need to be hard-coded in structs, dna does not recognize defines */ /* also defined in `DNA_space_types.h`. */ #ifndef FILE_MAXDIR |