diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-04 14:01:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-04 14:15:18 +0300 |
commit | 8683d4e88f2e64be0ec868f1c028f3c60262e948 (patch) | |
tree | 2c66764a58342489bc396ae8d2b43c82d895aca1 /source/blender/blenkernel/intern | |
parent | 9d30fade3ea9b03e0764ab5dc9a9263543a79a83 (diff) |
BKE_appdir: log details about path lookups
These were printf's, disabled by a define that could be uncommented.
Use logging since this can be useful when investigating any issue
with paths not being found at the expected location.
Without this any problem finding app-templates, Python's installation,
icons ... etc are quite difficult to troubleshoot especially on systems
without access to system-call tracing.
To use this run:
blender --log "bke.appdir" --log-level 3
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/appdir.c | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index dbf8a312181..65c8921666b 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -60,12 +60,6 @@ # include <unistd.h> #endif /* WIN32 */ -/** - * Print paths being tested, - * useful for debugging on systems without `strace` or similar utilities. - */ -// #define PATH_DEBUG - /* -------------------------------------------------------------------- */ /** \name Local Variables * \{ */ @@ -233,22 +227,16 @@ static bool test_path(char *targetpath, BLI_assert(!(folder_name == NULL && (subfolder_name != NULL))); BLI_path_join(targetpath, targetpath_len, path_base, folder_name, subfolder_name, NULL); if (check_is_dir == false) { -#ifdef PATH_DEBUG - printf("\t%s using without test: %s\n", __func__, targetpath); -#endif + CLOG_INFO(&LOG, 3, "using without test: '%s'", targetpath); return true; } if (BLI_is_dir(targetpath)) { -#ifdef PATH_DEBUG - printf("\t%s found: %s\n", __func__, targetpath); -#endif + CLOG_INFO(&LOG, 3, "found '%s'", targetpath); return true; } -#ifdef PATH_DEBUG - printf("\t%s missing: %s\n", __func__, targetpath); -#endif + CLOG_INFO(&LOG, 3, "missing '%s'", targetpath); /* Path not found, don't accidentally use it, * otherwise call this function with `check_is_dir` set to false. */ @@ -270,23 +258,17 @@ static bool test_env_path(char *path, const char *envvar, const bool check_is_di } if (check_is_dir == false) { -#ifdef PATH_DEBUG - printf("\t%s using without test: %s\n", __func__, env_path); -#endif + CLOG_INFO(&LOG, 3, "using env '%s' without test: '%s'", envvar, env_path); return true; } 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_path); -#endif + CLOG_INFO(&LOG, 3, "env '%s' found: %s", envvar, env_path); return true; } -#ifdef PATH_DEBUG - printf("\t%s env %s missing: %s\n", __func__, envvar, env_path); -#endif + CLOG_INFO(&LOG, 3, "env '%s' missing: %s", envvar, env_path); /* Path not found, don't accidentally use it, * otherwise call this function with `check_is_dir` set to false. */ @@ -315,9 +297,7 @@ static bool get_path_local_ex(char *targetpath, { char relfolder[FILE_MAX]; -#ifdef PATH_DEBUG - printf("%s...\n", __func__); -#endif + CLOG_INFO(&LOG, 3, "folder='%s', subfolder='%s'", folder_name, subfolder_name); if (folder_name) { /* `subfolder_name` may be NULL. */ BLI_path_join(relfolder, sizeof(relfolder), folder_name, subfolder_name, NULL); @@ -435,9 +415,7 @@ static bool get_path_user_ex(char *targetpath, return false; } -#ifdef PATH_DEBUG - printf("%s: %s\n", __func__, user_path); -#endif + CLOG_INFO(&LOG, 3, "'%s', folder='%s', subfolder='%s'", user_path, folder_name, subfolder_name); /* `subfolder_name` may be NULL. */ return test_path( @@ -492,9 +470,8 @@ static bool get_path_system_ex(char *targetpath, return false; } -#ifdef PATH_DEBUG - printf("%s: %s\n", __func__, system_path); -#endif + CLOG_INFO( + &LOG, 3, "'%s', folder='%s', subfolder='%s'", system_path, folder_name, subfolder_name); /* Try `$BLENDERPATH/folder_name/subfolder_name`, `subfolder_name` may be NULL. */ return test_path( @@ -744,10 +721,6 @@ const char *BKE_appdir_folder_id_version(const int folder_id, return ok ? path : NULL; } -#ifdef PATH_DEBUG -# undef PATH_DEBUG -#endif - /** \} */ /* -------------------------------------------------------------------- */ |