diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-05 10:26:10 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-05 10:26:10 +0400 |
commit | 384948908afd5567d6c730a8045a368e8c08e436 (patch) | |
tree | 5fd9e156242aedd9271a8d54ed02b5dc9149fb44 /source/blender/blenlib | |
parent | 34233e7fd661dbd378c4e11a1e0d29ed639fbffa (diff) |
patch [#34103] path_util_split_dirstring.patch, path_util_split_dirstring_2.patch, path_util_split_dirstring_3.patch
from Lawrence D'Oliveiro (ldo)
Get rid of BLI_splitdirstring, replace with calls to BLI_split_dirfile, BLI_split_dir_part and BLI_split_file_part as appropriate.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 30 | ||||
-rw-r--r-- | source/blender/blenlib/intern/storage.c | 2 |
4 files changed, 7 insertions, 28 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 92c68dee24d..20fc489cbc3 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -118,7 +118,6 @@ void BLI_newname(char *name, int add); int BLI_stringdec(const char *string, char *head, char *start, unsigned short *numlen); void BLI_stringenc(char *string, const char *head, const char *tail, unsigned short numlen, int pic); int BLI_split_name_num(char *left, int *nr, const char *name, char delim); -void BLI_splitdirstring(char *di, char *fi); /* make sure path separators conform to system one */ void BLI_clean(char *path) diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 3f8b21103b8..937fdf5f787 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -176,7 +176,7 @@ bool BLI_file_is_writable(const char *filename) else { /* file doesn't exist -- check I can create it in parent directory */ char parent[FILE_MAX]; - BLI_split_dirfile(filename, parent, NULL, sizeof parent, 0); + BLI_split_dirfile(filename, parent, NULL, sizeof(parent), 0); writable = access(parent, X_OK | W_OK) == 0; } return writable; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 045572ca69d..913a664b97f 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -867,23 +867,6 @@ bool BLI_path_cwd(char *path) return wasrelative; } - -/* 'di's filename component is moved into 'fi', di is made a dir path */ -/* FIXME: duplicates functionality of BLI_split_dirfile. */ -void BLI_splitdirstring(char *di, char *fi) -{ - char *lslash = (char *)BLI_last_slash(di); - - if (lslash) { - BLI_strncpy(fi, lslash + 1, FILE_MAXFILE); - *(lslash + 1) = 0; - } - else { - BLI_strncpy(fi, di, FILE_MAXFILE); - di[0] = 0; - } -} - /** * Copies into *last the part of *dir following the second-last slash. */ @@ -1433,15 +1416,12 @@ void BLI_make_exist(char *dir) */ void BLI_make_existing_file(const char *name) { - char di[FILE_MAX], fi[FILE_MAXFILE]; + char di[FILE_MAX]; BLI_strncpy(di, name, sizeof(di)); - /* FIXME: use BLI_split_dir_part instead and get rid of fi. */ - BLI_splitdirstring(di, fi); - - /* test exist */ - if (BLI_exists(di) == 0) { - BLI_dir_create_recursive(di); - } + BLI_split_dir_part(name, di, sizeof(di)); + + /* make if if the dir doesn't exist */ + BLI_dir_create_recursive(di); } /** diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 9263c250944..22558fca1c5 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -272,7 +272,7 @@ static void bli_builddir(const char *dirname, const char *relname, memset(file, 0, sizeof(struct direntry)); file->relname = dlink->name; file->path = BLI_strdupcat(dirname, dlink->name); - BLI_join_dirfile(fullname, sizeof fullname, dirname, dlink->name); + BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name); // use 64 bit file size, only needed for WIN32 and WIN64. // Excluding other than current MSVC compiler until able to test #ifdef WIN32 |