diff options
Diffstat (limited to 'source/blender/blenkernel/intern/preferences.c')
-rw-r--r-- | source/blender/blenkernel/intern/preferences.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/preferences.c b/source/blender/blenkernel/intern/preferences.c index 0b8e8d7c311..4bb2231bbb1 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" @@ -61,10 +62,6 @@ bUserAssetLibrary *BKE_preferences_asset_library_add(UserDef *userdef, return library; } -/** - * Unlink and free a library preference member. - * \note Free's \a library itself. - */ void BKE_preferences_asset_library_remove(UserDef *userdef, bUserAssetLibrary *library) { BLI_freelinkN(&userdef->asset_libraries, library); @@ -83,6 +80,14 @@ void BKE_preferences_asset_library_name_set(UserDef *userdef, sizeof(library->name)); } +void BKE_preferences_asset_library_path_set(bUserAssetLibrary *library, const char *path) +{ + BLI_strncpy(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); @@ -120,7 +125,8 @@ void BKE_preferences_asset_library_default_add(UserDef *userdef) return; } - bUserAssetLibrary *library = BKE_preferences_asset_library_add(userdef, DATA_("Default"), NULL); + bUserAssetLibrary *library = BKE_preferences_asset_library_add( + userdef, DATA_(BKE_PREFS_ASSET_LIBRARY_DEFAULT_NAME), NULL); /* Add new "Default" library under '[doc_path]/Blender/Assets'. */ BLI_path_join( |