BLI_tempfile: ensure the temporary directory is absolute
While unreported, there is nothing preventing CWD relative temporary directories being used. Resolve asserts & errors if the CWD changes at run-time.
This commit is contained in:
@@ -33,6 +33,14 @@ bool BLI_temp_directory_path_copy_if_valid(char *temp_directory,
|
||||
|
||||
/* Add a trailing slash if needed. */
|
||||
BLI_path_slash_ensure(temp_directory, buffer_size);
|
||||
|
||||
/* There's nothing preventing an environment variable (even preferences) from being CWD relative.
|
||||
* This causes:
|
||||
* - Asserts in code-paths which expect absolute paths (blend-file IO).
|
||||
* - The temporary directory to change if the CWD changes.
|
||||
* Avoid issues by ensuring the temporary directory is *never* CWD relative. */
|
||||
BLI_path_abs_from_cwd(temp_directory, buffer_size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user