mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-17 14:02:35 +00:00
fix: resolve relative input paths given on the command line (#14803)
Opening a model with a relative path, for example `orca-slicer ./some.3mf`, failed with "Loading of a model file failed." and "The file does not contain any geometry data.", while the same file opened by an absolute path or by drag and drop worked. GUI_App::init_app_config() changes the working directory to <data_dir>/log, and it runs from the GUI_App constructor because the app config is needed early for instance checking. The input files are opened much later, in post_init(), so a path still relative at that point resolved against the log directory instead of the directory OrcaSlicer was started from, and the 3MF reader failed to open it. Resolve the input paths in CLI::setup(), which runs before GUI_App is constructed and therefore before the working directory moves. Absolute paths are returned unchanged, so the forms that open today are unaffected, and custom open protocol URLs are passed through since post_init() hands those to the downloader rather than the file loader. The working directory change is left alone. It was added in #3248 so the TUTK logs land in the data directory instead of the working directory (#3209).
This commit is contained in:
@@ -7715,6 +7715,13 @@ bool CLI::setup(int argc, char **argv)
|
||||
this->print_help();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Orca: resolve here, while the process is still in the directory the user invoked it from.
|
||||
// GUI_App's constructor moves the working directory to <data_dir>/log, long before the GUI
|
||||
// opens these files in post_init(), and a relative path would then resolve against that.
|
||||
for (std::string &input_file : m_input_files)
|
||||
input_file = resolve_cli_input_path(input_file);
|
||||
|
||||
// Parse actions and transform options.
|
||||
for (auto const &opt_key : opt_order) {
|
||||
if (cli_actions_config_def.has(opt_key))
|
||||
|
||||
Reference in New Issue
Block a user