Fix: Relative "Temporary Files" preference cause trouble (can crash) #118856

Closed
Philipp Oeser wants to merge 1 commits from lichtwerk/blender:95411 into blender-v4.1-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

1 Commits

Author SHA1 Message Date
Philipp Oeser 956c1476cb Fix: Relative "Temporary Files" preference cause trouble (can crash)
An assert for this was added in 28c34d332f

But basically specifying "//" was still accepted in release builds.

This caused the following warning:

`WARN (bke.appdir): source/blender/blenkernel/intern/appdir.cc:1168
tempdir_session_create: Could not generate a temp file name for '//
blender_FkRpQj', falling back to '//'`

And then made all sorts of operators fail (most using `BKE_tempdir_base`
/ `BKE_tempdir_session` e.g. autosave or clipboard operators):

`Unable to save '//297042_autosave.blend': Permission denied`

Exporting to Collada would even crash because `COLLADASW::StreamWriter`
does not handle relative paths.
So fixes #95411.

Now only use the provided userdir if it is not relative (and fallback to
`BLI_temp_directory_path_get` otherwise).

NOTE: making this more obvious in the UI would probably be nice, too
(but it seems setting `alert` on a filepath row does not work properly
-- so this is skipped in this PR)
2024-02-28 16:23:00 +01:00