Bugfix: failure in launching on Windows with non-ASCII characters in username. #1011

This commit is contained in:
Alessandro Ranellucci 2013-02-22 18:40:00 +01:00
parent 28638019ae
commit 72df796185
2 changed files with 10 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}