Fix T86544: better cleanup of path given as command line argument.

When using non-default system separator in filename path, code would end up
with an absolute path mixing regular and alternative separator,
confusing the rest of the path manipulations later on.

So this commit add proper replacements of alternative separators, and
path normalization.
This commit is contained in:
Bastien Montagne 2021-06-10 18:37:46 +02:00
parent 509e0c5b76
commit fbd889ec28
Notes: blender-bot 2023-02-14 10:09:24 +01:00
Referenced by issue #86544, Opening Blender file with relative path breaks internal relative paths.
1 changed files with 2 additions and 0 deletions

View File

@ -1959,7 +1959,9 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data)
}
BLI_strncpy(filename, argv[0], sizeof(filename));
BLI_path_slash_native(filename);
BLI_path_abs_from_cwd(filename, sizeof(filename));
BLI_path_normalize(NULL, filename);
/* load the file */
BKE_reports_init(&reports, RPT_PRINT);