1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 #pragma once
17 
18 /** \file
19  * \ingroup bli
20  */
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 struct ListBase;
27 
28 void BKE_appdir_init(void);
29 
30 /* note on naming: typical _get() suffix is omitted here,
31  * since its the main purpose of the API. */
32 const char *BKE_appdir_folder_default(void);
33 bool BKE_appdir_folder_id_ex(const int folder_id,
34                              const char *subfolder,
35                              char *path,
36                              size_t path_len);
37 const char *BKE_appdir_folder_id(const int folder_id, const char *subfolder);
38 const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfolder);
39 const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder);
40 const char *BKE_appdir_folder_id_version(const int folder_id,
41                                          const int version,
42                                          const bool check_is_dir);
43 
44 bool BKE_appdir_app_is_portable_install(void);
45 bool BKE_appdir_app_template_any(void);
46 bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
47 bool BKE_appdir_app_template_has_userpref(const char *app_template);
48 void BKE_appdir_app_templates(struct ListBase *templates);
49 
50 /* Initialize path to program executable */
51 void BKE_appdir_program_path_init(const char *argv0);
52 
53 const char *BKE_appdir_program_path(void);
54 const char *BKE_appdir_program_dir(void);
55 
56 /* Return OS fonts directory. */
57 bool BKE_appdir_font_folder_default(char *dir);
58 
59 /* find python executable */
60 bool BKE_appdir_program_python_search(char *fullpath,
61                                       const size_t fullpath_len,
62                                       const int version_major,
63                                       const int version_minor);
64 
65 /* Initialize path to temporary directory. */
66 void BKE_tempdir_init(const char *userdir);
67 
68 const char *BKE_tempdir_base(void);
69 const char *BKE_tempdir_session(void);
70 void BKE_tempdir_session_purge(void);
71 
72 /* folder_id */
73 enum {
74   /* general, will find based on user/local/system priority */
75   BLENDER_DATAFILES = 2,
76 
77   /* user-specific */
78   BLENDER_USER_CONFIG = 31,
79   BLENDER_USER_DATAFILES = 32,
80   BLENDER_USER_SCRIPTS = 33,
81   BLENDER_USER_AUTOSAVE = 34,
82 
83   /* system */
84   BLENDER_SYSTEM_DATAFILES = 52,
85   BLENDER_SYSTEM_SCRIPTS = 53,
86   BLENDER_SYSTEM_PYTHON = 54,
87 };
88 
89 /* for BKE_appdir_folder_id_version only */
90 enum {
91   BLENDER_RESOURCE_PATH_USER = 0,
92   BLENDER_RESOURCE_PATH_LOCAL = 1,
93   BLENDER_RESOURCE_PATH_SYSTEM = 2,
94 };
95 
96 #define BLENDER_STARTUP_FILE "startup.blend"
97 #define BLENDER_USERPREF_FILE "userpref.blend"
98 #define BLENDER_QUIT_FILE "quit.blend"
99 #define BLENDER_BOOKMARK_FILE "bookmarks.txt"
100 #define BLENDER_HISTORY_FILE "recent-files.txt"
101 #define BLENDER_PLATFORM_SUPPORT_FILE "platform_support.txt"
102 
103 #ifdef __cplusplus
104 }
105 #endif
106