diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-09 15:38:57 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-09 15:43:34 +0300 |
commit | 05f821b094b44ef588d4c678193f76ae2ee1797d (patch) | |
tree | ed4dfadd21479d7150bd6370ff782ba0b8f33aa5 /source/blender/windowmanager/intern/wm_files.c | |
parent | 8f8ae06b515c0fe479ba8b3cfb27c354c031e483 (diff) |
Cleanup: remove unnecessary use of BLI_make_file_string
Use BLI_join_dirfile instead, also reduce right-shift.
Diffstat (limited to 'source/blender/windowmanager/intern/wm_files.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 13c1579d24b..38747bd706c 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1899,7 +1899,7 @@ static bool wm_file_write(bContext *C, /** \name Auto-Save API * \{ */ -static void wm_autosave_location(char *filepath) +static void wm_autosave_location(char filepath[FILE_MAX]) { const int pid = abs(getpid()); char path[1024]; @@ -1918,23 +1918,23 @@ static void wm_autosave_location(char *filepath) BLI_snprintf(path, sizeof(path), "%d_autosave.blend", pid); } + const char *tempdir_base = BKE_tempdir_base(); #ifdef WIN32 - /* XXX Need to investigate how to handle default location of '/tmp/' - * This is a relative directory on Windows, and it may be - * found. Example: - * Blender installed on D:\ drive, D:\ drive has D:\tmp\ - * Now, BLI_exists() will find '/tmp/' exists, but - * BLI_make_file_string will create string that has it most likely on C:\ - * through BLI_windows_get_default_root_dir(). - * If there is no C:\tmp autosave fails. */ - if (!BLI_exists(BKE_tempdir_base())) { + /* XXX Need to investigate how to handle default location of `/tmp/` + * This is a relative directory on Windows, and it may be found. Example: + * Blender installed on `D:\` drive, `D:\` drive has `D:\tmp\` Now, `BLI_exists()` + * will find `/tmp/` exists, but #BLI_make_file_string will create string + * that has it most likely on `C:\` through #BLI_windows_get_default_root_dir. + * If there is no `C:\tmp` autosave fails. */ + if (!BLI_exists(tempdir_base)) { const char *savedir = BKE_appdir_folder_id_create(BLENDER_USER_AUTOSAVE, NULL); - BLI_make_file_string("/", filepath, savedir, path); - return; + if (savedir) { + tempdir_base = savedir; + } } #endif - BLI_join_dirfile(filepath, FILE_MAX, BKE_tempdir_base(), path); + BLI_join_dirfile(filepath, FILE_MAX, tempdir_base, path); } static void wm_autosave_write(Main *bmain, wmWindowManager *wm) |