From 7e3425d433642d16f4a7ddfc1d7ec2d0b41b9a02 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 25 Mar 2014 14:07:03 +0100 Subject: [PATCH] Bugfix: wizard wasn't run when user supplied an existing empty directory as --datadir --- lib/Slic3r/GUI.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index 448a26e5..7d7bb7cf 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -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 $_;