Commit: 43fa4baa6cd704f35cb2086b21d703033de4e17e
Author: Campbell Barton
Date:   Sun Nov 23 15:54:29 2014 +0100
Branches: master
https://developer.blender.org/rB43fa4baa6cd704f35cb2086b21d703033de4e17e

Refactor: BLI_path_util (part 2)

Use BKE_appdir/tempdir naming prefix for functions extracted from BLI_path_util

===================================================================

M       source/blender/blenfont/intern/blf_lang.c
M       source/blender/blenfont/intern/blf_translation.c
M       source/blender/blenkernel/BKE_appdir.h
M       source/blender/blenkernel/intern/appdir.c
M       source/blender/blenkernel/intern/blender.c
M       source/blender/blenkernel/intern/modifier.c
M       source/blender/blenkernel/intern/pointcache.c
M       source/blender/blenkernel/intern/smoke.c
M       source/blender/compositor/intern/COM_Debug.cpp
M       source/blender/editors/interface/interface_icons.c
M       source/blender/editors/interface/resources.c
M       source/blender/editors/render/render_preview.c
M       source/blender/editors/space_file/file_ops.c
M       source/blender/editors/space_file/filesel.c
M       source/blender/editors/space_file/fsmenu.c
M       source/blender/editors/space_file/space_file.c
M       source/blender/editors/space_view3d/view3d_ops.c
M       source/blender/freestyle/intern/application/AppConfig.cpp
M       source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M       source/blender/imbuf/intern/colormanagement.c
M       source/blender/makesrna/intern/rna_userdef.c
M       source/blender/python/generic/py_capi_utils.c
M       source/blender/python/intern/bpy.c
M       source/blender/python/intern/bpy_app.c
M       source/blender/python/intern/bpy_interface.c
M       source/blender/render/intern/source/render_result.c
M       source/blender/windowmanager/intern/wm_files.c
M       source/blender/windowmanager/intern/wm_init_exit.c
M       source/blender/windowmanager/intern/wm_operators.c
M       source/creator/creator.c
M       source/gameengine/GamePlayer/ghost/GPG_ghost.cpp
M       source/gameengine/Ketsji/KX_PythonInit.cpp

===================================================================

diff --git a/source/blender/blenfont/intern/blf_lang.c 
b/source/blender/blenfont/intern/blf_lang.c
index 308e081..10614e8 100644
--- a/source/blender/blenfont/intern/blf_lang.c
+++ b/source/blender/blenfont/intern/blf_lang.c
@@ -80,7 +80,7 @@ static void free_locales(void)
 
 static void fill_locales(void)
 {
-       const char * const languages_path = BLI_get_folder(BLENDER_DATAFILES, 
"locale");
+       const char * const languages_path = 
BKE_appdir_folder_id(BLENDER_DATAFILES, "locale");
        char languages[FILE_MAX];
        LinkNode *lines = NULL, *line;
        char *str;
@@ -188,7 +188,7 @@ EnumPropertyItem *BLF_RNA_lang_enum_properties(void)
 void BLF_lang_init(void)
 {
 #ifdef WITH_INTERNATIONAL
-       const char * const messagepath = BLI_get_folder(BLENDER_DATAFILES, 
"locale");
+       const char * const messagepath = 
BKE_appdir_folder_id(BLENDER_DATAFILES, "locale");
 
        if (messagepath) {
                bl_locale_init(messagepath, TEXT_DOMAIN_NAME);
diff --git a/source/blender/blenfont/intern/blf_translation.c 
b/source/blender/blenfont/intern/blf_translation.c
index 276c681..e7d2c14 100644
--- a/source/blender/blenfont/intern/blf_translation.c
+++ b/source/blender/blenfont/intern/blf_translation.c
@@ -64,7 +64,7 @@ unsigned char *BLF_get_unifont(int *r_unifont_size)
 {
 #ifdef WITH_INTERNATIONAL
        if (unifont_ttf == NULL) {
-               const char * const fontpath = BLI_get_folder(BLENDER_DATAFILES, 
"fonts");
+               const char * const fontpath = 
BKE_appdir_folder_id(BLENDER_DATAFILES, "fonts");
                if (fontpath) {
                        char unifont_path[1024];
 
@@ -99,7 +99,7 @@ unsigned char *BLF_get_unifont_mono(int *r_unifont_size)
 {
 #ifdef WITH_INTERNATIONAL
        if (unifont_mono_ttf == NULL) {
-               const char *fontpath = BLI_get_folder(BLENDER_DATAFILES, 
"fonts");
+               const char *fontpath = BKE_appdir_folder_id(BLENDER_DATAFILES, 
"fonts");
                if (fontpath) {
                        char unifont_path[1024];
 
diff --git a/source/blender/blenkernel/BKE_appdir.h 
b/source/blender/blenkernel/BKE_appdir.h
index 3b2e70b..5e42f17 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -24,52 +24,52 @@
  *  \ingroup bli
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char *BLI_getDefaultDocumentFolder(void);
-
-const char *BLI_get_folder(int folder_id, const char *subfolder);
-const char *BLI_get_folder_create(int folder_id, const char *subfolder);
-const char *BLI_get_user_folder_notest(int folder_id, const char *subfolder);
-const char *BLI_get_folder_version(const int id, const int ver, const bool 
do_check);
-
+/* 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_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 ver, 
const bool do_check);
 
 /* Initialize path to program executable */
-void BLI_init_program_path(const char *argv0);
-/* Initialize path to temporary directory.
- * NOTE: On Window userdir will be set to the temporary directory! */
-void BLI_temp_dir_init(char *userdir);
+void        BKE_appdir_program_path_init(const char *argv0);
 
-const char *BLI_program_path(void);
-const char *BLI_program_dir(void);
-const char *BLI_temp_dir_session(void);
-const char *BLI_temp_dir_base(void);
-void BLI_system_temporary_dir(char *dir);
-void BLI_temp_dir_session_purge(void);
+const char *BKE_appdir_program_path(void);
+const char *BKE_appdir_program_dir(void);
 
+/* Initialize path to temporary directory. */
+void        BKE_tempdir_init(char *userdir);
+void        BKE_tempdir_system_init(char *dir);
 
-/* folder_id */
-
-/* general, will find based on user/local/system priority */
-#define BLENDER_DATAFILES           2
+const char *BKE_tempdir_base(void);
+const char *BKE_tempdir_session(void);
+void        BKE_tempdir_session_purge(void);
 
-/* user-specific */
-#define BLENDER_USER_CONFIG         31
-#define BLENDER_USER_DATAFILES      32
-#define BLENDER_USER_SCRIPTS        33
-#define BLENDER_USER_AUTOSAVE       34
 
-/* system */
-#define BLENDER_SYSTEM_DATAFILES    52
-#define BLENDER_SYSTEM_SCRIPTS      53
-#define BLENDER_SYSTEM_PYTHON       54
-
-/* for BLI_get_folder_version only */
-#define BLENDER_RESOURCE_PATH_USER      0
-#define BLENDER_RESOURCE_PATH_LOCAL     1
-#define BLENDER_RESOURCE_PATH_SYSTEM    2
+/* 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"
@@ -77,9 +77,4 @@ void BLI_temp_dir_session_purge(void);
 #define BLENDER_BOOKMARK_FILE   "bookmarks.txt"
 #define BLENDER_HISTORY_FILE    "recent-files.txt"
 
-
-#ifdef __cplusplus
-}
-#endif
-
 #endif  /* __BKE_APPDIR_H__ */
diff --git a/source/blender/blenkernel/intern/appdir.c 
b/source/blender/blenkernel/intern/appdir.c
index 66dc4c1..e37b9a7 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -19,6 +19,8 @@
 
 /** \file blender/blenlib/intern/appdir.c
  *  \ingroup bke
+ *
+ * Access to application level directories.
  */
 
 #include <stdlib.h>
@@ -65,7 +67,7 @@ static char btempdir_session[FILE_MAX] = "";  /* volatile 
temporary directory */
 /* This is now only used to really get the user's default document folder */
 /* On Windows I chose the 'Users/<MyUserName>/Documents' since it's used
  * as default location to save documents */
-const char *BLI_getDefaultDocumentFolder(void)
+const char *BKE_appdir_folder_default(void)
 {
 #ifndef WIN32
        const char * const xdg_documents_dir = getenv("XDG_DOCUMENTS_DIR");
@@ -354,7 +356,7 @@ static bool get_path_system(char *targetpath, const char 
*folder_name, const cha
 
 /* get a folder out of the 'folder_id' presets for paths */
 /* returns the path if found, NULL string if not */
-const char *BLI_get_folder(int folder_id, const char *subfolder)
+const char *BKE_appdir_folder_id(const int folder_id, const char *subfolder)
 {
        const int ver = BLENDER_VERSION;
        static char path[FILE_MAX] = "";
@@ -408,7 +410,7 @@ const char *BLI_get_folder(int folder_id, const char 
*subfolder)
 /**
  * Returns the path to a folder in the user area without checking that it 
actually exists first.
  */
-const char *BLI_get_user_folder_notest(int folder_id, const char *subfolder)
+const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char 
*subfolder)
 {
        const int ver = BLENDER_VERSION;
        static char path[FILE_MAX] = "";
@@ -440,7 +442,7 @@ const char *BLI_get_user_folder_notest(int folder_id, const 
char *subfolder)
 /**
  * Returns the path to a folder in the user area, creating it if it doesn't 
exist.
  */
-const char *BLI_get_folder_create(int folder_id, const char *subfolder)
+const char *BKE_appdir_folder_id_create(int folder_id, const char *subfolder)
 {
        const char *path;
 
@@ -448,10 +450,10 @@ const char *BLI_get_folder_create(int folder_id, const 
char *subfolder)
        if (!ELEM(folder_id, BLENDER_USER_DATAFILES, BLENDER_USER_CONFIG, 
BLENDER_USER_SCRIPTS, BLENDER_USER_AUTOSAVE))
                return NULL;
        
-       path = BLI_get_folder(folder_id, subfolder);
+       path = BKE_appdir_folder_id(folder_id, subfolder);
        
        if (!path) {
-               path = BLI_get_user_folder_notest(folder_id, subfolder);
+               path = BKE_appdir_folder_id_user_notest(folder_id, subfolder);
                if (path) BLI_dir_create_recursive(path);
        }
        
@@ -462,11 +464,11 @@ const char *BLI_get_folder_create(int folder_id, const 
char *subfolder)
  * Returns the path of the top-level version-specific local, user or system 
directory.
  * If do_check, then the result will be NULL if the directory doesn't exist.
  */
-const char *BLI_get_folder_version(const int id, const int ver, const bool 
do_check)
+const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, 
const bool do_check)
 {
        static char path[FILE_MAX] = "";
        bool ok;
-       switch (id) {
+       switch (folder_id) {
                case BLENDER_RESOURCE_PATH_USER:
                        ok = get_path_user(path, NULL, NULL, NULL, ver);
                        break;
@@ -648,7 +650,7 @@ static void bli_where_am_i(char *fullname, const size_t 
maxlen, const char *name
        }
 }
 
-void BLI_init_program_path(const char *argv0)
+void BKE_appdir_program_path_init(const char *argv0)
 {
        bli_where_am_i(bprogname, sizeof(bprogname), argv0);
        BLI_split_dir_part(bprogname, bprogdir, sizeof(bprogdir));
@@ -657,7 +659,7 @@ void BLI_init_program_path(const char *argv0)
 /**
  * Path to executable
  */
-const char *BLI_program_path(void)
+const char *BKE_appdir_program_path(void)
 {
        return bprogname;
 }
@@ -665,7 +667,7 @@ const char *BLI_program_path(void)
 /**
  * Path to directory of executable
  */
-const char *BLI_program_dir(void)
+const char *BKE_appdir_program_dir(void)
 {
        return bprogdir;
 }
@@ -684,7 +686,7 @@ const char *BLI_program_dir(void)
 static void BLI_where_is_temp(char *fullname, char *basename, const size_t 
maxlen, char *userdir)
 {
        /* Clear existing temp dir, if needed. */
-       BLI_temp_dir_session_purge();
+       BKE_tempdir_session_purge();
 
        fullname[0] = '\0';
        if (basename) {
@@ -764,8 +766,10 @@ static void BLI_where_is_temp(char *fullname, char 
*basename, const size_t maxle
  * Sets btempdir_base to userdir if specified and is a valid directory, 
otherwise
  * chooses a suitable OS-specific temporary directory.
  * Sets btempdir_session to a mkdtemp-generated sub-dir of btempdir_base.
+ *
+ * \note On Window userdir will be set to the temporary directory!
  */
-void BLI_temp_dir_init(char *userdir)
+void BKE_tempdir_init(char *userdir)
 {
        BLI_whe

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to