mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 00:36:24 +08:00
Set sensible defaults if autosave and datadir aren't specified on the CLI instead of segfaulting when the GUI is enabled.
datadir goes to home directory, autosave is in a temp dir and has format slic3r_autosave_xxx.
This commit is contained in:
parent
6bb8a750bc
commit
a0a2055916
@ -354,8 +354,18 @@ int CLI::run(int argc, char **argv) {
|
||||
if (actions.empty()) {
|
||||
#ifdef USE_WX
|
||||
GUI::App *gui = new GUI::App();
|
||||
gui->autosave = this->config.getString("autosave");
|
||||
gui->datadir = this->config.getString("datadir");
|
||||
try {
|
||||
gui->autosave = this->config.getString("autosave");
|
||||
} catch(Slic3r::UnknownOptionException &e) {
|
||||
// if no autosave, set a sensible default.
|
||||
gui->autosave = wxFileName::CreateTempFileName("slic3r_autosave_").ToStdString();
|
||||
}
|
||||
try {
|
||||
gui->datadir = this->config.getString("datadir");
|
||||
} catch(Slic3r::UnknownOptionException &e) {
|
||||
// if no datadir on the CLI, set a default.
|
||||
gui->datadir = GUI::home().ToStdString();
|
||||
}
|
||||
GUI::App::SetInstance(gui);
|
||||
wxEntry(argc, argv);
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user