Bugfix: crash when reading/writing files to paths containing non-ASCII characters on Windows. #651 #865

This commit is contained in:
Alessandro Ranellucci 2013-01-13 10:18:34 +01:00
parent 73aae07e74
commit ad9be0e4d7
8 changed files with 20 additions and 11 deletions

View file

@ -946,7 +946,7 @@ sub new_from_cli {
if ($args{$opt_key}) {
die "Invalid value for --${_}-gcode: file does not exist\n"
if !-e $args{$opt_key};
open my $fh, "<", $args{$opt_key}
Slic3r::open(\my $fh, "<", $args{$opt_key})
or die "Failed to open $args{$opt_key}\n";
binmode $fh, ':utf8';
$args{$opt_key} = do { local $/; <$fh> };
@ -1251,7 +1251,7 @@ sub write_ini {
my $class = shift;
my ($file, $ini) = @_;
open my $fh, '>', $file;
Slic3r::open(\my $fh, '>', $file);
binmode $fh, ':utf8';
my $localtime = localtime;
printf $fh "# generated by Slic3r $Slic3r::VERSION on %s\n", "$localtime";
@ -1269,7 +1269,7 @@ sub read_ini {
my ($file) = @_;
local $/ = "\n";
open my $fh, '<', $file;
Slic3r::open(\my $fh, '<', $file);
binmode $fh, ':utf8';
my $ini = { _ => {} };