diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-11 04:06:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-11 04:06:16 +0300 |
commit | 1008137f724902dbd5041caf8660432b3e5e1549 (patch) | |
tree | be20cc007a5437423e328dae2c19e8d8e0cfd682 | |
parent | d6ca95b1a31799fc36905294410f1c284f7b14be (diff) |
simplify BLI_path_abs by using BLI_cleanup_path
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 2195607e6c7..0dc09606533 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -677,8 +677,9 @@ int BLI_path_abs(char *path, const char *basepath) #endif BLI_strncpy(base, basepath, sizeof(base)); - - BLI_cleanup_file(NULL, base); + + /* file component is ignored, so dont bother with the trailing slash */ + BLI_cleanup_path(NULL, base); /* push slashes into unix mode - strings entering this part are potentially messed up: having both back- and forward slashes. @@ -707,17 +708,9 @@ int BLI_path_abs(char *path, const char *basepath) } else { BLI_strncpy(path, tmp, FILE_MAX); } - - if (path[0]!='\0') { - if ( path[strlen(path)-1]=='/') { - /* remove the '/' so we avoid BLI_cleanup_dir adding an extra \ in WIN32 */ - path[strlen(path)-1] = '\0'; - BLI_cleanup_dir(NULL, path); - } else { - BLI_cleanup_file(NULL, path); - } - } - + + BLI_cleanup_path(NULL, path); + #ifdef WIN32 /* skip first two chars, which in case of absolute path will be drive:/blabla and |