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/editors | |
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/editors')
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/buttons_ops.c | 7 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/util/ed_util.c | 3 |
4 files changed, 9 insertions, 14 deletions
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 714b1be36a7..bf81db3f3a0 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -683,14 +683,11 @@ static int fluid_init_filepaths(Object *fsDomain, char *targetDir, char *targetF } if (targetDir[0] == '\0' || (!dirExist)) { - char blendDir[FILE_MAX]; char blendFile[FILE_MAX]; // invalid dir, reset to current/previous - BLI_strncpy(blendDir, G.main->name, FILE_MAX); - BLI_splitdirstring(blendDir, blendFile); + BLI_split_file_part(G.main->name, blendFile, sizeof(blendFile)); BLI_replace_extension(blendFile, FILE_MAX, ""); /* strip .blend */ - BLI_snprintf(newSurfdataPath, FILE_MAX, "//fluidsimdata/%s_%s_", blendFile, fsDomain->id.name); BLI_snprintf(debugStrBuffer, 256, "fluidsimBake::error - warning resetting output dir to '%s'\n", newSurfdataPath); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 812ea8c7597..bd53a8e41c5 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -113,7 +113,6 @@ static int file_browse_exec(bContext *C, wmOperator *op) /* add slash for directories, important for some properties */ if (RNA_property_subtype(fbo->prop) == PROP_DIRPATH) { - char name[FILE_MAX]; int is_relative = RNA_boolean_get(op->ptr, "relative_path"); id = fbo->ptr.id.data; @@ -132,8 +131,10 @@ static int file_browse_exec(bContext *C, wmOperator *op) } BLI_add_slash(str); } - else - BLI_splitdirstring(str, name); + else { + char * const lslash = (char *)BLI_last_slash(str); + if (lslash) lslash[1] = '\0'; + } } RNA_property_string_set(&fbo->ptr, fbo->prop, str); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 55f632412ee..46acd2519c2 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1603,7 +1603,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) SpaceImage *sima = CTX_wm_space_image(C); ImBuf *ibuf; int tot = 0; - char di[FILE_MAX], fi[FILE_MAX]; + char di[FILE_MAX]; if (sima->image == NULL) return OPERATOR_CANCELLED; @@ -1632,10 +1632,8 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op) for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next) if (ibuf->userflags & IB_BITMAPDIRTY) break; - - BLI_strncpy(di, ibuf->name, FILE_MAX); - BLI_splitdirstring(di, fi); - + + BLI_split_dir_part(ibuf->name, di, sizeof(di)); BKE_reportf(op->reports, RPT_INFO, "%d image(s) will be saved in %s", tot, di); for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next) { diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index f0f31b1e793..73062c57526 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -187,8 +187,7 @@ void unpack_menu(bContext *C, const char *opname, const char *id_name, const cha if (G.relbase_valid) { char local_name[FILE_MAXDIR + FILE_MAX], fi[FILE_MAX]; - BLI_strncpy(local_name, abs_name, sizeof(local_name)); - BLI_splitdirstring(local_name, fi); + BLI_split_file_part(abs_name, fi, sizeof(fi)); BLI_snprintf(local_name, sizeof(local_name), "//%s/%s", folder, fi); if (strcmp(abs_name, local_name) != 0) { switch (checkPackedFile(local_name, pf)) { |