diff options
author | Julian Eisel <julian@blender.org> | 2020-12-11 18:07:43 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-11 18:20:53 +0300 |
commit | 273aca964e895b5a5075c3fbd02589b9a908fc22 (patch) | |
tree | 2b5981439351451e02610aebab29ac04338269c4 /source/blender/blenkernel/BKE_appdir.h | |
parent | 6de85a0cc08da26f63ae0512f19fa5360556c2bd (diff) |
Refactor/extend BKE API to get special user directories
The previous `BKE_appdir_folder_default()` was confusing, it would return the
home directory on Linux and macOS, but the Documents directory on Windows.
Plus, for the Asset Browser, we want to use the Documents directory for the
default asset library on all platforms.
This attempts to clean up the API to avoid confusion, while adding the newly
needed functionality.
* `BKE_appdir_folder_default()` should behave as before, but the implementation
changed:
** Removes apparently incorrect usage of `XDG_DOCUMENTS_DIR` on Unix systems -
this seems to be a config file variable, not an environment variable. Always
use `$HOME` instead, which this ended up using anyway.
** On Windows it doesn't attempt to use `%HOME%` anymore and gets the Documents
directory directly.
* Add `BKE_appdir_folder_home()` to gives the top-level user directory on all
platforms.
* Add `BKE_appdir_folder_documents()` to always get the user documents
directory on all platforms.
There should be no user noticable behavior change.
Differential Revision: https://developer.blender.org/D9800
Reviewed by: Brecht Van Lommel
Diffstat (limited to 'source/blender/blenkernel/BKE_appdir.h')
-rw-r--r-- | source/blender/blenkernel/BKE_appdir.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h index 6da6079ea2a..c9d671597e8 100644 --- a/source/blender/blenkernel/BKE_appdir.h +++ b/source/blender/blenkernel/BKE_appdir.h @@ -31,6 +31,8 @@ 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_home(void); +bool BKE_appdir_folder_documents(char *dir); bool BKE_appdir_folder_id_ex(const int folder_id, const char *subfolder, char *path, |