Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2021-11-19 18:39:28 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-11-19 18:39:28 +0300
commit9e3a913b35df9f9519d48e18223192a34ab8f22a (patch)
treecbf17875f91dfff850ad6ad95b5f4170b4820e10 /source/blender/blenkernel/intern
parentec71054a9b7bf0d2218fa230855fc9af2e71bcc2 (diff)
parent1a1ddcb5e22b2e6ad4d7506c709ca93ca64096d3 (diff)
Merge remote-tracking branch 'origin/blender-v3.0-release'
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/preferences.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/preferences.c b/source/blender/blenkernel/intern/preferences.c
index 0a10601f751..41046563f98 100644
--- a/source/blender/blenkernel/intern/preferences.c
+++ b/source/blender/blenkernel/intern/preferences.c
@@ -24,6 +24,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -83,6 +84,18 @@ void BKE_preferences_asset_library_name_set(UserDef *userdef,
sizeof(library->name));
}
+/* Set the library path, ensuring it is pointing to a directory.
+ * Single blend files can only act as "Current File" library; libraries on disk
+ * should always be directories. If the path does not exist, that's fine; it can
+ * created as directory if necessary later. */
+void BKE_preferences_asset_library_path_set(bUserAssetLibrary *library, const char *path)
+{
+ BLI_strncpy_utf8(library->path, path, sizeof(library->path));
+ if (BLI_is_file(library->path)) {
+ BLI_path_parent_dir(library->path);
+ }
+}
+
bUserAssetLibrary *BKE_preferences_asset_library_find_from_index(const UserDef *userdef, int index)
{
return BLI_findlink(&userdef->asset_libraries, index);