[Bf-blender-cvs] [7456ac6e4b8] master: Cleanup: clarify names in appdir

Campbell Barton noreply at git.blender.org
Sun Oct 4 13:15:42 CEST 2020


Commit: 7456ac6e4b8d5294254421103f2dccb9b50909fb
Author: Campbell Barton
Date:   Sun Oct 4 11:00:06 2020 +1100
Branches: master
https://developer.blender.org/rB7456ac6e4b8d5294254421103f2dccb9b50909fb

Cleanup: clarify names in appdir

- ver -> version.
- env -> env_path.

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

M	source/blender/blenkernel/BKE_appdir.h
M	source/blender/blenkernel/intern/appdir.c

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

diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index 8e63631b9d5..4488e23f791 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -36,7 +36,7 @@ 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 int version,
                                          const bool check_is_dir);
 
 bool BKE_appdir_app_is_portable_install(void);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index fd5c39b8054..97ebca7692e 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -90,11 +90,11 @@ static char btempdir_session[FILE_MAX] = "";
 /**
  * \returns a formatted representation of the specified version number. Non-re-entrant!
  */
-static char *blender_version_decimal(const int ver)
+static char *blender_version_decimal(const int version)
 {
   static char version_str[5];
-  BLI_assert(ver < 1000);
-  BLI_snprintf(version_str, sizeof(version_str), "%d.%02d", ver / 100, ver % 100);
+  BLI_assert(version < 1000);
+  BLI_snprintf(version_str, sizeof(version_str), "%d.%02d", version / 100, version % 100);
   return version_str;
 }
 
@@ -185,7 +185,7 @@ bool BKE_appdir_font_folder_default(
  * \param subfolder_name: Second sub-directory (optional).
  * \param check_is_dir: When false, return true even if the path doesn't exist.
  *
- * \note The names for optional paths only follow other usage in this function,
+ * \note The names for optional paths only follow other usage in this file,
  * the names don't matter for this function.
  *
  * \note If it's useful we could take an arbitrary number of paths.
@@ -231,28 +231,28 @@ static bool test_path(char *targetpath,
  */
 static bool test_env_path(char *path, const char *envvar, const bool check_is_dir)
 {
-  const char *env = envvar ? BLI_getenv(envvar) : NULL;
-  if (!env) {
+  const char *env_path = envvar ? BLI_getenv(envvar) : NULL;
+  if (!env_path) {
     return false;
   }
 
   if (check_is_dir == false) {
 #ifdef PATH_DEBUG
-    printf("\t%s using without test: %s\n", __func__, targetpath);
+    printf("\t%s using without test: %s\n", __func__, env_path);
 #endif
     return true;
   }
 
-  if (BLI_is_dir(env)) {
-    BLI_strncpy(path, env, FILE_MAX);
+  if (BLI_is_dir(env_path)) {
+    BLI_strncpy(path, env_path, FILE_MAX);
 #ifdef PATH_DEBUG
-    printf("\t%s env %s found: %s\n", __func__, envvar, env);
+    printf("\t%s env %s found: %s\n", __func__, envvar, env_path);
 #endif
     return true;
   }
 
 #ifdef PATH_DEBUG
-  printf("\t%s env %s missing: %s\n", __func__, envvar, env);
+  printf("\t%s env %s missing: %s\n", __func__, envvar, env_path);
 #endif
 
   /* Path not found, don't accidentally use it,
@@ -269,7 +269,7 @@ static bool test_env_path(char *path, const char *envvar, const bool check_is_di
  * \param folder_name: Optional folder name within version-specific directory.
  * \param subfolder_name: Optional sub-folder name within folder_name.
  *
- * \param ver: To construct name of version-specific directory within #bprogdir.
+ * \param version: To construct name of version-specific directory within #bprogdir.
  * \param check_is_dir: When false, return true even if the path doesn't exist.
  * \return true if such a directory exists.
  */
@@ -277,7 +277,7 @@ static bool get_path_local_ex(char *targetpath,
                               size_t targetpath_len,
                               const char *folder_name,
                               const char *subfolder_name,
-                              const int ver,
+                              const int version,
                               const bool check_is_dir)
 {
   char relfolder[FILE_MAX];
@@ -309,7 +309,7 @@ static bool get_path_local_ex(char *targetpath,
                    targetpath_len,
                    check_is_dir,
                    path_base,
-                   blender_version_decimal(ver),
+                   blender_version_decimal(version),
                    relfolder);
 }
 static bool get_path_local(char *targetpath,
@@ -317,10 +317,10 @@ static bool get_path_local(char *targetpath,
                            const char *folder_name,
                            const char *subfolder_name)
 {
-  const int ver = BLENDER_VERSION;
+  const int version = BLENDER_VERSION;
   const bool check_is_dir = true;
   return get_path_local_ex(
-      targetpath, targetpath_len, folder_name, subfolder_name, ver, check_is_dir);
+      targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
 }
 
 /**
@@ -372,7 +372,7 @@ static bool get_path_environment(char *targetpath,
  * \param targetpath: String to return path.
  * \param folder_name: default name of folder within user area.
  * \param subfolder_name: optional name of sub-folder within folder.
- * \param ver: Blender version, used to construct a sub-directory name.
+ * \param version: Blender version, used to construct a sub-directory name.
  * \param check_is_dir: When false, return true even if the path doesn't exist.
  * \return true if it was able to construct such a path.
  */
@@ -380,7 +380,7 @@ static bool get_path_user_ex(char *targetpath,
                              size_t targetpath_len,
                              const char *folder_name,
                              const char *subfolder_name,
-                             const int ver,
+                             const int version,
                              const bool check_is_dir)
 {
   char user_path[FILE_MAX];
@@ -389,11 +389,11 @@ static bool get_path_user_ex(char *targetpath,
   /* for portable install, user path is always local */
   if (BKE_appdir_app_is_portable_install()) {
     return get_path_local_ex(
-        targetpath, targetpath_len, folder_name, subfolder_name, ver, check_is_dir);
+        targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
   }
   user_path[0] = '\0';
 
-  user_base_path = (const char *)GHOST_getUserDir(ver, blender_version_decimal(ver));
+  user_base_path = (const char *)GHOST_getUserDir(version, blender_version_decimal(version));
   if (user_base_path) {
     BLI_strncpy(user_path, user_base_path, FILE_MAX);
   }
@@ -415,10 +415,10 @@ static bool get_path_user(char *targetpath,
                           const char *folder_name,
                           const char *subfolder_name)
 {
-  const int ver = BLENDER_VERSION;
+  const int version = BLENDER_VERSION;
   const bool check_is_dir = true;
   return get_path_user_ex(
-      targetpath, targetpath_len, folder_name, subfolder_name, ver, check_is_dir);
+      targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
 }
 
 /**
@@ -427,7 +427,7 @@ static bool get_path_user(char *targetpath,
  * \param targetpath: String to return path.
  * \param folder_name: default name of folder within installation area.
  * \param subfolder_name: optional name of sub-folder within folder.
- * \param ver: Blender version, used to construct a sub-directory name.
+ * \param version: Blender version, used to construct a sub-directory name.
  * \param check_is_dir: When false, return true even if the path doesn't exist.
  * \return true if it was able to construct such a path.
  */
@@ -435,7 +435,7 @@ static bool get_path_system_ex(char *targetpath,
                                size_t targetpath_len,
                                const char *folder_name,
                                const char *subfolder_name,
-                               const int ver,
+                               const int version,
                                const bool check_is_dir)
 {
   char system_path[FILE_MAX];
@@ -450,7 +450,7 @@ static bool get_path_system_ex(char *targetpath,
   }
 
   system_path[0] = '\0';
-  system_base_path = (const char *)GHOST_getSystemDir(ver, blender_version_decimal(ver));
+  system_base_path = (const char *)GHOST_getSystemDir(version, blender_version_decimal(version));
   if (system_base_path) {
     BLI_strncpy(system_path, system_base_path, FILE_MAX);
   }
@@ -473,10 +473,10 @@ static bool get_path_system(char *targetpath,
                             const char *folder_name,
                             const char *subfolder_name)
 {
-  const int ver = BLENDER_VERSION;
+  const int version = BLENDER_VERSION;
   const bool check_is_dir = true;
   return get_path_system_ex(
-      targetpath, targetpath_len, folder_name, subfolder_name, ver, check_is_dir);
+      targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir);
 }
 
 /** \} */
@@ -610,7 +610,7 @@ const char *BKE_appdir_folder_id(const 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;
+  const int version = BLENDER_VERSION;
   static char path[FILE_MAX] = "";
   const bool check_is_dir = false;
 
@@ -620,28 +620,28 @@ const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *su
               path, sizeof(path), subfolder, "BLENDER_USER_DATAFILES", check_is_dir)) {
         break;
       }
-      get_path_user_ex(path, sizeof(path), "datafiles", subfolder, ver, check_is_dir);
+      get_path_user_ex(path, sizeof(path), "datafiles", subfolder, version, check_is_dir);
       break;
     case BLENDER_USER_CONFIG:
       if (get_path_environment_ex(
               path, sizeof(path), subfolder, "BLENDER_USER_CONFIG", check_is_dir)) {
         break;
       }
-      get_path_user_ex(path, sizeof(path), "config", subfolder, ver, check_is_dir);
+      get_path_user_ex(path, sizeof(path), "config", subfolder, version, check_is_dir);
       break;
     case BLENDER_USER_AUTOSAVE:
       if (get_path_environment_ex(
               path, sizeof(path), subfolder, "BLEND

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list