BLI_path: use native normalize (avoids // prefix on UNIX)

This commit is contained in:
Campbell Barton
2023-05-15 19:47:53 +10:00
parent 7eb55a5fa9
commit 5285cd9a7b
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -386,7 +386,7 @@ static bool get_path_local_ex(char *targetpath,
char osx_resourses[FILE_MAX + 4 + 9];
BLI_path_join(osx_resourses, sizeof(osx_resourses), g_app.program_dirname, "..", "Resources");
/* Remove the '/../' added above. */
BLI_path_normalize(osx_resourses);
BLI_path_normalize_native(osx_resourses);
path_base = osx_resourses;
#endif
return test_path(targetpath,
@@ -879,7 +879,7 @@ static void where_am_i(char *program_filepath,
BLI_path_program_search(program_filepath, program_filepath_maxncpy, program_name);
}
/* Remove "/./" and "/../" so string comparisons can be used on the path. */
BLI_path_normalize(program_filepath);
BLI_path_normalize_native(program_filepath);
# if defined(DEBUG)
if (!STREQ(program_name, program_filepath)) {
@@ -898,7 +898,7 @@ void BKE_appdir_program_path_init(const char *argv0)
* which must point to the Python module for data-files to be detected. */
STRNCPY(g_app.program_filepath, argv0);
BLI_path_abs_from_cwd(g_app.program_filepath, sizeof(g_app.program_filepath));
BLI_path_normalize(g_app.program_filepath);
BLI_path_normalize_native(g_app.program_filepath);
if (g_app.program_dirname[0] == '\0') {
/* First time initializing, the file binary path isn't valid from a Python module.
+1 -1
View File
@@ -2070,7 +2070,7 @@ static bool file_execute(bContext *C, SpaceFile *sfile)
}
else {
BLI_path_abs(params->dir, BKE_main_blendfile_path(bmain));
BLI_path_normalize(params->dir);
BLI_path_normalize_native(params->dir);
BLI_path_append_dir(params->dir, sizeof(params->dir), file->relpath);
}
ED_file_change_dir(C);
+1 -1
View File
@@ -2065,7 +2065,7 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
STRNCPY(filepath, argv[0]);
BLI_path_slash_native(filepath);
BLI_path_abs_from_cwd(filepath, sizeof(filepath));
BLI_path_normalize(filepath);
BLI_path_normalize_native(filepath);
/* load the file */
BKE_reports_init(&reports, RPT_PRINT);