diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 8bd7fa684..09d1071ea 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -47,7 +47,7 @@ sub OnInit { $self->{notifier} = Slic3r::GUI::Notifier->new; # locate or create data directory - $datadir = Wx::StandardPaths::Get->GetUserDataDir; + $datadir ||= Wx::StandardPaths::Get->GetUserDataDir; Slic3r::debugf "Data directory: %s\n", $datadir; my $run_wizard = (-d $datadir) ? 0 : 1; for ($datadir, "$datadir/print", "$datadir/filament", "$datadir/printer") { diff --git a/slic3r.pl b/slic3r.pl index 2e9c87072..cc0af0a60 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -27,6 +27,7 @@ my %cli_options = (); 'save=s' => \$opt{save}, 'load=s@' => \$opt{load}, 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, + 'datadir=s' => \$opt{datadir}, 'export-svg' => \$opt{export_svg}, 'merge|m' => \$opt{merge}, ); @@ -71,6 +72,10 @@ if ($opt{save}) { my $gui; if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") { $gui = Slic3r::GUI->new; + { + no warnings 'once'; + $Slic3r::GUI::datadir = $opt{datadir} if $opt{datadir}; + } $gui->{skeinpanel}->load_config_file($_) for @{$opt{load}}; $gui->{skeinpanel}->load_config($cli_config); $gui->MainLoop;