[Bf-blender-cvs] [ac0cbb7d1e] app-templates: Use BKE_appdir_folder_id_ex

Campbell Barton noreply at git.blender.org
Fri Mar 24 00:49:06 CET 2017


Commit: ac0cbb7d1e438b6bf27a49c1e25fc9087e3edab1
Author: Campbell Barton
Date:   Fri Mar 24 10:49:32 2017 +1100
Branches: app-templates
https://developer.blender.org/rBac0cbb7d1e438b6bf27a49c1e25fc9087e3edab1

Use BKE_appdir_folder_id_ex

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

M	source/blender/blenkernel/BKE_appdir.h
M	source/blender/blenkernel/intern/appdir.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h
index f7774a90f9..ac8f861fa5 100644
--- a/source/blender/blenkernel/BKE_appdir.h
+++ b/source/blender/blenkernel/BKE_appdir.h
@@ -34,7 +34,7 @@ const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *su
 const char *BKE_appdir_folder_id_version(const int folder_id, const int ver, const bool do_check);
 
 bool BKE_appdir_app_template_any(void);
-bool BKE_appdir_app_template_id_search(char *path, size_t path_len, const char *app_template);
+bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len);
 
 /* Initialize path to program executable */
 void        BKE_appdir_program_path_init(const char *argv0);
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 0b6ea4f014..43fd47981b 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -698,26 +698,31 @@ static const int app_template_directory_id[2] = {
  */
 bool BKE_appdir_app_template_any(void)
 {
+	char temp_dir[FILE_MAX];
 	for (int i = 0; i < 2; i++) {
-		if (BKE_appdir_folder_id(app_template_directory_id[i], app_template_directory_search[i])) {
+		if (BKE_appdir_folder_id_ex(
+		        app_template_directory_id[i], app_template_directory_search[i],
+		        temp_dir, sizeof(temp_dir)))
+		{
 			return true;
 		}
 	}
 	return false;
 }
 
-bool BKE_appdir_app_template_id_search(char *path, size_t path_len, const char *app_template)
+bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
 {
 	for (int i = 0; i < 2; i++) {
 		char subdir[FILE_MAX];
 		BLI_join_dirfile(subdir, sizeof(subdir), app_template_directory_search[i], app_template);
-		const char *filepath_startup_template = BKE_appdir_folder_id(app_template_directory_id[i], subdir);
-		if (filepath_startup_template) {
-			BLI_strncpy(path, filepath_startup_template, path_len);
-			return path;
+		if (BKE_appdir_folder_id_ex(
+		        app_template_directory_id[i], subdir,
+		        path, path_len))
+		{
+			return true;
 		}
 	}
-	return NULL;
+	return false;
 }
 
 /**
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 5c44e6f09b..82ded46317 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -726,7 +726,7 @@ int wm_homefile_read(
 	}
 
 	if (app_template != NULL) {
-		BKE_appdir_app_template_id_search(template_directory, sizeof(template_directory), app_template);
+		BKE_appdir_app_template_id_search(app_template, template_directory, sizeof(template_directory));
 	}
 
 	/* insert template name into startup file */
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 981ef60fad..39e06ccc3c 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1770,8 +1770,8 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
 		char template_directory[FILE_MAX];
 
 		if (BKE_appdir_app_template_id_search(
-		        template_directory, sizeof(template_directory),
-		        U.app_template))
+		        U.app_template,
+		        template_directory, sizeof(template_directory)))
 		{
 			BLI_join_dirfile(
 			        splash_filepath, sizeof(splash_filepath), template_directory,




More information about the Bf-blender-cvs mailing list