diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-02-15 02:33:16 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-02-15 02:40:41 +0300 |
commit | 1c883fe6468c9fd3859d24e63590d4011984d52e (patch) | |
tree | 1fe62d7d09a854c0d92e44b2c685b04db3ff876a /source/blender/editors/space_file | |
parent | 68a52a7fa9327d48f52deddd8c81cc35f4192fe0 (diff) |
Cleanup: make BLI_make_exist local to the file selector
This isn't a general utility, and the name wasn't descriptive.
Diffstat (limited to 'source/blender/editors/space_file')
-rw-r--r-- | source/blender/editors/space_file/file_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 15 |
2 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index b0ff67844d8..5ed936bc749 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -137,5 +137,6 @@ void file_execute_region_panels_register(struct ARegionType *art); /* file_utils.c */ void file_tile_boundbox(const ARegion *ar, FileLayout *layout, const int file, rcti *r_bounds); +void file_path_existing_or_default_root(char *dir); #endif /* __FILE_INTERN_H__ */ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 800726c6fb0..b328b32263c 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1046,12 +1046,23 @@ int filelist_geticon(struct FileList *filelist, const int index, const bool is_m /* ********** Main ********** */ +static void parent_dir_until_exists_or_default_root(char *dir) +{ + if (!BLI_parent_dir_until_exists(dir)) { +#ifdef WIN32 + get_default_root(dir); +#else + strcpy(dir, "/"); +#endif + } +} + static bool filelist_checkdir_dir(struct FileList *UNUSED(filelist), char *r_dir, const bool do_change) { if (do_change) { - BLI_make_exist(r_dir); + parent_dir_until_exists_or_default_root(r_dir); return true; } else { @@ -1072,7 +1083,7 @@ static bool filelist_checkdir_lib(struct FileList *UNUSED(filelist), if (do_change && !is_valid) { /* if not a valid library, we need it to be a valid directory! */ - BLI_make_exist(r_dir); + parent_dir_until_exists_or_default_root(r_dir); return true; } return is_valid; |