diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 75ea26ed3..f9fb3319d 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -88,9 +88,14 @@ sub parallelize { } } +sub encode_path { + my ($filename) = @_; + return encode('locale_fs', $filename); +} + sub open { my ($fh, $mode, $filename) = @_; - return CORE::open $$fh, $mode, encode('locale_fs', $filename); + return CORE::open $$fh, $mode, encode_path($filename); } 1; diff --git a/lib/Slic3r/GUI.pm b/lib/Slic3r/GUI.pm index fb53b5cb5..a4e9f6d90 100644 --- a/lib/Slic3r/GUI.pm +++ b/lib/Slic3r/GUI.pm @@ -55,14 +55,15 @@ sub OnInit { # locate or create data directory $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") { + my $encoded_datadir = Slic3r::encode_path($datadir); + my $run_wizard = (-d $encoded_datadir) ? 0 : 1; + for ($encoded_datadir, "$encoded_datadir/print", "$encoded_datadir/filament", "$encoded_datadir/printer") { mkdir or $self->fatal_error("Slic3r was unable to create its data directory at $_ (errno: $!).") unless -d $_; } # load settings - if (-f "$datadir/slic3r.ini") { + if (-f "$encoded_datadir/slic3r.ini") { my $ini = eval { Slic3r::Config->read_ini("$datadir/slic3r.ini") }; $Settings = $ini if $ini; }