mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 04:45:57 +08:00
Fix regression with non-ASCII paths on Windows. We'll need to work more on this when porting stuff to C++. #2955
This commit is contained in:
parent
69bef2a971
commit
60f0ca52e3
@ -289,7 +289,7 @@ sub _load_stl {
|
||||
my $input_file = Slic3r::decode_path($dialog->GetPaths);
|
||||
$dialog->Destroy;
|
||||
|
||||
my $model = Slic3r::Model->read_from_file($input_file);
|
||||
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||
my $mesh = $model->raw_mesh;
|
||||
my $expolygons = $mesh->horizontal_projection;
|
||||
|
||||
|
@ -384,7 +384,7 @@ sub quick_slice {
|
||||
);
|
||||
|
||||
# keep model around
|
||||
my $model = Slic3r::Model->read_from_file($input_file);
|
||||
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||
|
||||
$sprint->apply_config($config);
|
||||
$sprint->set_model($model);
|
||||
|
@ -816,7 +816,7 @@ sub add_tin {
|
||||
return if $offset < 0;
|
||||
|
||||
foreach my $input_file (@input_files) {
|
||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||
Slic3r::GUI::show_error($self, $@) if $@;
|
||||
next if !$model;
|
||||
|
||||
@ -847,7 +847,7 @@ sub load_file {
|
||||
|
||||
local $SIG{__WARN__} = Slic3r::GUI::warning_catcher($self);
|
||||
|
||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||
Slic3r::GUI::show_error($self, $@) if $@;
|
||||
|
||||
my @obj_idx = ();
|
||||
|
@ -350,7 +350,7 @@ sub on_btn_load {
|
||||
|
||||
my @input_files = wxTheApp->open_model($self);
|
||||
foreach my $input_file (@input_files) {
|
||||
my $model = eval { Slic3r::Model->read_from_file($input_file) };
|
||||
my $model = eval { Slic3r::Model->read_from_file(Slic3r::encode_path($input_file)) };
|
||||
if ($@) {
|
||||
Slic3r::GUI::show_error($self, $@);
|
||||
next;
|
||||
|
18
slic3r.pl
18
slic3r.pl
@ -74,9 +74,9 @@ my @external_configs = ();
|
||||
if ($opt{load}) {
|
||||
foreach my $configfile (@{$opt{load}}) {
|
||||
$configfile = Slic3r::decode_path($configfile);
|
||||
if (-e $configfile) {
|
||||
if (-e Slic3r::encode_path($configfile)) {
|
||||
push @external_configs, Slic3r::Config->load($configfile);
|
||||
} elsif (-e "$FindBin::Bin/$configfile") {
|
||||
} elsif (-e Slic3r::encode_path("$FindBin::Bin/$configfile")) {
|
||||
printf STDERR "Loading $FindBin::Bin/$configfile\n";
|
||||
push @external_configs, Slic3r::Config->load("$FindBin::Bin/$configfile");
|
||||
} else {
|
||||
@ -99,7 +99,7 @@ if ($opt{save}) {
|
||||
if (@{$config->get_keys} > 0) {
|
||||
$config->save($opt{save});
|
||||
} else {
|
||||
Slic3r::Config->new_from_defaults->save($opt{save});
|
||||
Slic3r::Config->new_from_defaults->save(Slic3r::decode_path($opt{save}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ if (@ARGV) { # slicing from command line
|
||||
if ($opt{cut}) {
|
||||
foreach my $file (@ARGV) {
|
||||
$file = Slic3r::decode_path($file);
|
||||
my $model = Slic3r::Model->read_from_file($file);
|
||||
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||
$model->add_default_instances;
|
||||
my $mesh = $model->mesh;
|
||||
$mesh->translate(0, 0, -$mesh->bounding_box->z_min);
|
||||
@ -175,7 +175,7 @@ if (@ARGV) { # slicing from command line
|
||||
my ($grid_x, $grid_y) = split /[,x]/, $opt{cut_grid}, 2;
|
||||
foreach my $file (@ARGV) {
|
||||
$file = Slic3r::decode_path($file);
|
||||
my $model = Slic3r::Model->read_from_file($file);
|
||||
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||
$model->add_default_instances;
|
||||
my $mesh = $model->mesh;
|
||||
my $bb = $mesh->bounding_box;
|
||||
@ -217,7 +217,7 @@ if (@ARGV) { # slicing from command line
|
||||
if ($opt{split}) {
|
||||
foreach my $file (@ARGV) {
|
||||
$file = Slic3r::decode_path($file);
|
||||
my $model = Slic3r::Model->read_from_file($file);
|
||||
my $model = Slic3r::Model->read_from_file(Slic3r::encode_path($file));
|
||||
$model->add_default_instances;
|
||||
my $mesh = $model->mesh;
|
||||
$mesh->repair;
|
||||
@ -236,10 +236,10 @@ if (@ARGV) { # slicing from command line
|
||||
$input_file = Slic3r::decode_path($input_file);
|
||||
my $model;
|
||||
if ($opt{merge}) {
|
||||
my @models = map Slic3r::Model->read_from_file($_), $input_file, (splice @ARGV, 0);
|
||||
my @models = map Slic3r::Model->read_from_file($_), Slic3r::encode_path($input_file), (splice @ARGV, 0);
|
||||
$model = Slic3r::Model->merge(@models);
|
||||
} else {
|
||||
$model = Slic3r::Model->read_from_file($input_file);
|
||||
$model = Slic3r::Model->read_from_file(Slic3r::encode_path($input_file));
|
||||
}
|
||||
$model->repair;
|
||||
|
||||
@ -266,7 +266,7 @@ if (@ARGV) { # slicing from command line
|
||||
my ($percent, $message) = @_;
|
||||
printf "=> %s\n", $message;
|
||||
},
|
||||
output_file => $opt{output},
|
||||
output_file => Slic3r::decode_path($opt{output}),
|
||||
);
|
||||
|
||||
$sprint->apply_config($config);
|
||||
|
Loading…
x
Reference in New Issue
Block a user