Moved initialization of Slic3r XS datadir variable to GUI.pm
Solves https://github.com/prusa3d/Slic3r/issues/594
This commit is contained in:
parent
2f54bf5bca
commit
6aff27f3ab
2 changed files with 9 additions and 6 deletions
|
@ -52,6 +52,8 @@ use constant FILE_WILDCARDS => {
|
||||||
};
|
};
|
||||||
use constant MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(known stl obj amf prusa)};
|
use constant MODEL_WILDCARD => join '|', @{&FILE_WILDCARDS}{qw(known stl obj amf prusa)};
|
||||||
|
|
||||||
|
# Datadir provided on the command line.
|
||||||
|
our $datadir;
|
||||||
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
||||||
our $no_plater;
|
our $no_plater;
|
||||||
our @cb;
|
our @cb;
|
||||||
|
@ -72,6 +74,12 @@ sub OnInit {
|
||||||
$self->SetAppDisplayName('Slic3r Prusa Edition');
|
$self->SetAppDisplayName('Slic3r Prusa Edition');
|
||||||
Slic3r::debugf "wxWidgets version %s, Wx version %s\n", &Wx::wxVERSION_STRING, $Wx::VERSION;
|
Slic3r::debugf "wxWidgets version %s, Wx version %s\n", &Wx::wxVERSION_STRING, $Wx::VERSION;
|
||||||
|
|
||||||
|
# Set the Slic3r data directory at the Slic3r XS module.
|
||||||
|
# Unix: ~/.Slic3r
|
||||||
|
# Windows: "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r"
|
||||||
|
# Mac: "~/Library/Application Support/Slic3r"
|
||||||
|
Slic3r::set_data_dir($datadir || Wx::StandardPaths::Get->GetUserDataDir);
|
||||||
|
|
||||||
$self->{notifier} = Slic3r::GUI::Notifier->new;
|
$self->{notifier} = Slic3r::GUI::Notifier->new;
|
||||||
$self->{app_config} = Slic3r::GUI::AppConfig->new;
|
$self->{app_config} = Slic3r::GUI::AppConfig->new;
|
||||||
$self->{preset_bundle} = Slic3r::GUI::PresetBundle->new;
|
$self->{preset_bundle} = Slic3r::GUI::PresetBundle->new;
|
||||||
|
|
|
@ -100,17 +100,12 @@ if ($opt{save}) {
|
||||||
my $config = Slic3r::Config::new_from_defaults;
|
my $config = Slic3r::Config::new_from_defaults;
|
||||||
$config->apply($cli_config);
|
$config->apply($cli_config);
|
||||||
|
|
||||||
# locate or create data directory
|
|
||||||
# Unix: ~/.Slic3r
|
|
||||||
# Windows: "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r"
|
|
||||||
# Mac: "~/Library/Application Support/Slic3r"
|
|
||||||
Slic3r::set_data_dir($opt{datadir} || Wx::StandardPaths::Get->GetUserDataDir);
|
|
||||||
|
|
||||||
# launch GUI
|
# launch GUI
|
||||||
my $gui;
|
my $gui;
|
||||||
if ((!@ARGV || $opt{gui}) && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
if ((!@ARGV || $opt{gui}) && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
||||||
{
|
{
|
||||||
no warnings 'once';
|
no warnings 'once';
|
||||||
|
$Slic3r::GUI::datadir = Slic3r::decode_path($opt{datadir} // '');
|
||||||
$Slic3r::GUI::no_controller = $opt{no_controller};
|
$Slic3r::GUI::no_controller = $opt{no_controller};
|
||||||
$Slic3r::GUI::no_plater = $opt{no_plater};
|
$Slic3r::GUI::no_plater = $opt{no_plater};
|
||||||
$Slic3r::GUI::autosave = $opt{autosave};
|
$Slic3r::GUI::autosave = $opt{autosave};
|
||||||
|
|
Loading…
Reference in a new issue