diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-10-06 11:49:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-10-06 11:49:58 +0300 |
commit | 359d1bd580c138c2b76b2afaed2a9069d5676707 (patch) | |
tree | 85d1403f1f4a08862387ff2eee9f9a917981d126 /source/blender/blenkernel/intern/image.c | |
parent | 9f15bcb218ef32d5f15e1e13235d2d7fa667e04a (diff) |
Cleanup: use BLI_path_basename
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index c314131e246..c421c67d9e5 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -704,8 +704,7 @@ void BKE_image_alpha_mode_from_extension(Image *image) Image *BKE_image_load(Main *bmain, const char *filepath) { Image *ima; - int file, len; - const char *libname; + int file; char str[FILE_MAX]; BLI_strncpy(str, filepath, sizeof(str)); @@ -717,13 +716,7 @@ Image *BKE_image_load(Main *bmain, const char *filepath) return NULL; close(file); - /* create a short library name */ - len = strlen(filepath); - - while (len > 0 && filepath[len - 1] != '/' && filepath[len - 1] != '\\') len--; - libname = filepath + len; - - ima = image_alloc(bmain, libname, IMA_SRC_FILE, IMA_TYPE_IMAGE); + ima = image_alloc(bmain, BLI_path_basename(filepath), IMA_SRC_FILE, IMA_TYPE_IMAGE); BLI_strncpy(ima->name, filepath, sizeof(ima->name)); if (BLI_testextensie_array(filepath, imb_ext_movie)) |