[Bf-blender-cvs] [85499bb] asset-experiments: Fix crash in append/link on windows (sigh).
Bastien Montagne
noreply at git.blender.org
Wed May 13 17:14:55 CEST 2015
Commit: 85499bb5e817e583f7574d6a6e0759c37ddcab62
Author: Bastien Montagne
Date: Wed May 13 17:06:44 2015 +0200
Branches: asset-experiments
https://developer.blender.org/rB85499bb5e817e583f7574d6a6e0759c37ddcab62
Fix crash in append/link on windows (sigh).
===================================================================
M source/blender/editors/space_file/filelist.c
===================================================================
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 45ef4e1..94e3264 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -1316,7 +1316,7 @@ int filelist_numfiles(struct FileList *filelist)
static const char *fileentry_uiname(const char *root, const char *relpath, const int typeflag, char *buff)
{
- char *name;
+ char *name = NULL;
if (typeflag & FILE_TYPE_BLENDERLIB) {
char abspath[FILE_MAX_LIBEXTRA];
@@ -1328,11 +1328,14 @@ static const char *fileentry_uiname(const char *root, const char *relpath, const
name = group;
}
}
- else if (typeflag & FILE_TYPE_DIR) {
- name = (char *)relpath;
- }
- else {
- name = (char *)BLI_path_basename(relpath);
+ /* Depending on platforms, 'my_file.blend/..' might be viewed as dir or not... */
+ if (!name) {
+ if (typeflag & FILE_TYPE_DIR) {
+ name = (char *)relpath;
+ }
+ else {
+ name = (char *)BLI_path_basename(relpath);
+ }
}
BLI_assert(name);
@@ -1351,7 +1354,7 @@ void filelist_setdir(struct FileList *filelist, char *r_dir)
{
#ifndef NDEBUG
size_t len = strlen(r_dir);
- BLI_assert((len < FILE_MAX_LIBEXTRA) && r_dir[len - 1] == '/');
+ BLI_assert((len < FILE_MAX_LIBEXTRA) && ELEM(r_dir[len - 1], SEP, ALTSEP));
#endif
BLI_cleanup_dir(G.main->name, r_dir);
More information about the Bf-blender-cvs
mailing list