Bugfix: wizard wasn't run when user supplied an existing empty directory as --datadir

xs-model
Alessandro Ranellucci 2014-03-25 14:07:03 +01:00
parent fed8783e30
commit 7e3425d433
1 changed files with 4 additions and 1 deletions

View File

@ -82,7 +82,10 @@ sub OnInit {
$datadir ||= Wx::StandardPaths::Get->GetUserDataDir;
$datadir = Slic3r::encode_path($datadir);
Slic3r::debugf "Data directory: %s\n", $datadir;
my $run_wizard = (-d $datadir) ? 0 : 1;
# just checking for existence of $datadir is not enough: it may be an empty directory
# supplied as argument to --datadir; in that case we should still run the wizard
my $run_wizard = (-d $datadir && -e "$datadir/slic3r.ini") ? 0 : 1;
for ($datadir, "$datadir/print", "$datadir/filament", "$datadir/printer") {
mkdir or $self->fatal_error("Slic3r was unable to create its data directory at $_ (errno: $!).")
unless -d $_;