Skip to content

Commit de48d62

Browse files
mpapernolanewei120
authored andcommitted
Restore support for datadir CLI argument to specify settings storage folder.
1 parent 5e59769 commit de48d62

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/BambuStudio.cpp‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8341,8 +8341,6 @@ bool CLI::setup(int argc, char **argv)
83418341
for (const t_optiondef_map::value_type &optdef : *options)
83428342
m_config.option(optdef.first, true);
83438343

8344-
//set_data_dir(m_config.opt_string("datadir"));
8345-
83468344
//FIXME Validating at this stage most likely does not make sense, as the config is not fully initialized yet.
83478345
if (!validity.empty()) {
83488346
boost::nowide::cerr << "Params in command line error: "<< std::endl;
@@ -8351,6 +8349,13 @@ bool CLI::setup(int argc, char **argv)
83518349
return false;
83528350
}
83538351

8352+
// Set custom configuration storage location if invoked with --datadir argument.
8353+
if (m_config.has("datadir") && !m_config.opt_string("datadir").empty()) {
8354+
// Don't validate existence or create it right now, should be done in GUI_App::init_app_config(), same as for default data dir.
8355+
// We do want to store the full path in native format because that's how all other sources of the global data_dir are stored.
8356+
set_data_dir(boost::filesystem::absolute(m_config.opt_string("datadir")).make_preferred().string());
8357+
}
8358+
83548359
return true;
83558360
}
83568361

‎src/libslic3r/PrintConfig.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9839,6 +9839,11 @@ CLIMiscConfigDef::CLIMiscConfigDef()
98399839
def->tooltip = L("Automatically export current configuration to the specified file.");
98409840
*/
98419841

9842+
def = this->add("datadir", coString);
9843+
def->label = "Configuration data directory";
9844+
def->tooltip = "Use and store all program settings at the given directory instead of the default location.";
9845+
def->cli_params = "dir";
9846+
98429847
def = this->add("outputdir", coString);
98439848
def->label = "Output directory";
98449849
def->tooltip = "Output directory for the exported files.";

0 commit comments

Comments
 (0)