Support preset names with Unicode characters. #2527

This commit is contained in:
Alessandro Ranellucci 2015-01-13 23:19:19 +01:00
parent 9c08dfb50c
commit aa5bafb8be
2 changed files with 3 additions and 2 deletions

View file

@ -217,6 +217,7 @@ sub presets {
opendir my $dh, Slic3r::encode_path("$Slic3r::GUI::datadir/$section")
or die "Failed to read directory $Slic3r::GUI::datadir/$section (errno: $!)\n";
foreach my $file (grep /\.ini$/i, readdir $dh) {
$file = Slic3r::decode_path($file);
my $name = basename($file);
$name =~ s/\.ini$//;
$presets{$name} = "$Slic3r::GUI::datadir/$section/$file";

View file

@ -1390,8 +1390,8 @@ sub config {
return Slic3r::Config->new_from_defaults(@$keys);
} else {
if (!-e $self->file) {
Slic3r::GUI::show_error($self, "The selected preset does not exist anymore (" . $self->file . ").");
return;
Slic3r::GUI::show_error(undef, "The selected preset does not exist anymore (" . $self->file . ").");
return undef;
}
# apply preset values on top of defaults