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
109 lines
3.6 KiB
C++
109 lines
3.6 KiB
C++
/*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
#pragma once
|
|
|
|
/** \file
|
|
* \ingroup bli
|
|
*/
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
struct ListBase;
|
|
|
|
void BKE_appdir_init(void);
|
|
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,
|
|
size_t path_len);
|
|
const char *BKE_appdir_folder_id(const int folder_id, const char *subfolder);
|
|
const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfolder);
|
|
const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder);
|
|
const char *BKE_appdir_folder_id_version(const int folder_id,
|
|
const int version,
|
|
const bool check_is_dir);
|
|
|
|
bool BKE_appdir_app_is_portable_install(void);
|
|
bool BKE_appdir_app_template_any(void);
|
|
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
|
|
bool BKE_appdir_app_template_has_userpref(const char *app_template);
|
|
void BKE_appdir_app_templates(struct ListBase *templates);
|
|
|
|
/* Initialize path to program executable */
|
|
void BKE_appdir_program_path_init(const char *argv0);
|
|
|
|
const char *BKE_appdir_program_path(void);
|
|
const char *BKE_appdir_program_dir(void);
|
|
|
|
/* Return OS fonts directory. */
|
|
bool BKE_appdir_font_folder_default(char *dir);
|
|
|
|
/* find python executable */
|
|
bool BKE_appdir_program_python_search(char *fullpath,
|
|
const size_t fullpath_len,
|
|
const int version_major,
|
|
const int version_minor);
|
|
|
|
/* Initialize path to temporary directory. */
|
|
void BKE_tempdir_init(const char *userdir);
|
|
|
|
const char *BKE_tempdir_base(void);
|
|
const char *BKE_tempdir_session(void);
|
|
void BKE_tempdir_session_purge(void);
|
|
|
|
/* folder_id */
|
|
enum {
|
|
/* general, will find based on user/local/system priority */
|
|
BLENDER_DATAFILES = 2,
|
|
|
|
/* user-specific */
|
|
BLENDER_USER_CONFIG = 31,
|
|
BLENDER_USER_DATAFILES = 32,
|
|
BLENDER_USER_SCRIPTS = 33,
|
|
BLENDER_USER_AUTOSAVE = 34,
|
|
|
|
/* system */
|
|
BLENDER_SYSTEM_DATAFILES = 52,
|
|
BLENDER_SYSTEM_SCRIPTS = 53,
|
|
BLENDER_SYSTEM_PYTHON = 54,
|
|
};
|
|
|
|
/* for BKE_appdir_folder_id_version only */
|
|
enum {
|
|
BLENDER_RESOURCE_PATH_USER = 0,
|
|
BLENDER_RESOURCE_PATH_LOCAL = 1,
|
|
BLENDER_RESOURCE_PATH_SYSTEM = 2,
|
|
};
|
|
|
|
#define BLENDER_STARTUP_FILE "startup.blend"
|
|
#define BLENDER_USERPREF_FILE "userpref.blend"
|
|
#define BLENDER_QUIT_FILE "quit.blend"
|
|
#define BLENDER_BOOKMARK_FILE "bookmarks.txt"
|
|
#define BLENDER_HISTORY_FILE "recent-files.txt"
|
|
#define BLENDER_PLATFORM_SUPPORT_FILE "platform_support.txt"
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|