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:
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_appdir.h6
-rw-r--r--source/blender/blenkernel/intern/appdir.c20
2 files changed, 25 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index 07132201e87..65485058dd7 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -21,6 +21,8 @@
#include <stddef.h>
+#include "BLI_compiler_attrs.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -32,7 +34,9 @@ void BKE_appdir_exit(void);
/* note on naming: typical _get() suffix is omitted here,
* since its the main purpose of the API. */
-const char *BKE_appdir_folder_default(void);
+const char *BKE_appdir_folder_default(void) ATTR_WARN_UNUSED_RESULT;
+const char *BKE_appdir_folder_root(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
+const char *BKE_appdir_folder_default_or_root(void) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL;
const char *BKE_appdir_folder_home(void);
bool BKE_appdir_folder_documents(char *dir);
bool BKE_appdir_folder_caches(char *r_path, size_t path_len);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index ce4ab8a4ba1..08a3b7d0bbb 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -170,6 +170,26 @@ const char *BKE_appdir_folder_default(void)
#endif /* WIN32 */
}
+const char *BKE_appdir_folder_root(void)
+{
+#ifndef WIN32
+ return "/";
+#else
+ static char root[4];
+ BLI_windows_get_default_root_dir(root);
+ return root;
+#endif
+}
+
+const char *BKE_appdir_folder_default_or_root(void)
+{
+ const char *path = BKE_appdir_folder_default();
+ if (path == NULL) {
+ path = BKE_appdir_folder_root();
+ }
+ return path;
+}
+
/**
* Get the user's home directory, i.e.
* - Unix: `$HOME`