Commit: 22b84424c702a6a85ccf127dfcbb6ce28b101774
Author: Campbell Barton
Date:   Fri Sep 9 11:13:05 2022 +1000
Branches: master
https://developer.blender.org/rB22b84424c702a6a85ccf127dfcbb6ce28b101774

Cleanup: check for Python module in BKE_appdir_program_path_init

Replace the argument with an in ifdef in BKE_appdir_program_path_init.
At the time `blenkernel` didn't define WITH_PYTHON_MODULE, since it does
now there is no need for an argument. With the minor benefit of fewer
preprocessor checks in the main() function.

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

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

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

diff --git a/source/blender/blenkernel/BKE_appdir.h 
b/source/blender/blenkernel/BKE_appdir.h
index 16488bdbf09..dcacc2ca7b3 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -105,11 +105,8 @@ void BKE_appdir_app_templates(struct ListBase *templates);
 
 /**
  * Initialize path to program executable.
- *
- * \param strict: When true, use `argv0` unmodified (besides making absolute & 
normalizing).
- * Otherwise other methods may be used to find the program path, including 
searching `$PATH`.
  */
-void BKE_appdir_program_path_init(const char *argv0, bool strict);
+void BKE_appdir_program_path_init(const char *argv0);
 
 /**
  * Path to executable
diff --git a/source/blender/blenkernel/intern/appdir.c 
b/source/blender/blenkernel/intern/appdir.c
index 4bd8cfd5f47..845a890ba8b 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -793,6 +793,8 @@ const char *BKE_appdir_folder_id_version(const int 
folder_id,
  * \param fullname: The full path and full name of the executable
  * (must be #FILE_MAX minimum)
  * \param name: The name of the executable (usually `argv[0]`) to be checked
+ * \param strict: When true, use `argv0` unmodified (besides making absolute & 
normalizing).
+ * Otherwise other methods may be used to find the program path, including 
searching `$PATH`.
  */
 static void where_am_i(char *fullname, const size_t maxlen, const char *name, 
const bool strict)
 {
@@ -864,8 +866,16 @@ static void where_am_i(char *fullname, const size_t 
maxlen, const char *name, co
   }
 }
 
-void BKE_appdir_program_path_init(const char *argv0, const bool strict)
+void BKE_appdir_program_path_init(const char *argv0)
 {
+#ifdef WITH_PYTHON_MODULE
+  /* NOTE(@campbellbarton): Always use `argv[0]` as is, when building as a 
Python module.
+   * Otherwise other methods of detecting the binary that override this 
argument
+   * which must point to the Python module for data-files to be detected. */
+  const bool strict = true;
+#else
+  const bool strict = false;
+#endif
   where_am_i(g_app.program_filepath, sizeof(g_app.program_filepath), argv0, 
strict);
   BLI_split_dir_part(g_app.program_filepath, g_app.program_dirname, 
sizeof(g_app.program_dirname));
 }
diff --git a/source/creator/creator.c b/source/creator/creator.c
index e7e9eeed79a..7f236a39974 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -396,17 +396,7 @@ int main(int argc,
 #endif
 
   /* Initialize path to executable. */
-  {
-#ifdef WITH_PYTHON_MODULE
-    /* NOTE(@campbellbarton): Always use `argv[0]` as is, when building as a 
Python module.
-     * Otherwise other methods of detecting the binary that override this 
argument
-     * which must point to the Python module for data-files to be detected. */
-    const bool strict = true;
-#else
-    const bool strict = false;
-#endif
-    BKE_appdir_program_path_init(argv[0], strict);
-  }
+  BKE_appdir_program_path_init(argv[0]);
 
   BLI_threadapi_init();

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to