Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2017-08-03 18:31:31 +0300
committerbubnikv <bubnikv@gmail.com>2017-08-03 18:31:31 +0300
commit138501872426ae1fc7023478dd1deba96d936ecf (patch)
tree74825b7caf247a6761d1cb0705edd16297e700ca /slic3r.pl
parent31085fb1d70510e3d73c64c0b7fc7a394b6e6f72 (diff)
Unicode handling:
Removed the Perl dependencies on Encode, Encode::Locale and Unicode::Normalize. Added dependency on boost::locale. Added encode_path, decode_path, normalize_utf8 functions to Slic3r.xs Slic3r.xs has been made mostly utf8 safe by using the boost::nowide library, thanks to @alexrj for the idea. Simplified the encode_path / decode_path stuff: wxWidgets are unicode already, so there is no need to decode_path() from it. Perl / win32 interfacing is non-unicode, so decode_path() is executed on ARGV just at the beginning of the perl scripts.
Diffstat (limited to 'slic3r.pl')
-rwxr-xr-xslic3r.pl14
1 files changed, 6 insertions, 8 deletions
diff --git a/slic3r.pl b/slic3r.pl
index 26a7f51d3..1d3807a6c 100755
--- a/slic3r.pl
+++ b/slic3r.pl
@@ -18,6 +18,9 @@ use Time::HiRes qw(gettimeofday tv_interval);
$|++;
binmode STDOUT, ':utf8';
+# Convert all parameters from the local code page to utf8 on Windows.
+@ARGV = map Slic3r::decode_path($_), @ARGV if $^O eq 'MSWin32';
+
our %opt = ();
my %cli_options = ();
{
@@ -65,7 +68,6 @@ my %cli_options = ();
my @external_configs = ();
if ($opt{load}) {
foreach my $configfile (@{$opt{load}}) {
- $configfile = Slic3r::decode_path($configfile);
if (-e $configfile) {
push @external_configs, Slic3r::Config->load($configfile);
} elsif (-e "$FindBin::Bin/$configfile") {
@@ -102,7 +104,7 @@ my $gui;
if ((!@ARGV || $opt{gui}) && !$opt{save} && eval "require Slic3r::GUI; 1") {
{
no warnings 'once';
- $Slic3r::GUI::datadir = Slic3r::decode_path($opt{datadir} // '');
+ $Slic3r::GUI::datadir = $opt{datadir} // '';
$Slic3r::GUI::no_controller = $opt{no_controller};
$Slic3r::GUI::no_plater = $opt{no_plater};
$Slic3r::GUI::autosave = $opt{autosave};
@@ -111,7 +113,7 @@ if ((!@ARGV || $opt{gui}) && !$opt{save} && eval "require Slic3r::GUI; 1") {
setlocale(LC_NUMERIC, 'C');
$gui->{mainframe}->load_config_file($_) for @{$opt{load}};
$gui->{mainframe}->load_config($cli_config);
- my @input_files = map Slic3r::decode_path($_), @ARGV;
+ my @input_files = @ARGV;
$gui->{mainframe}{plater}->load_files(\@input_files) unless $opt{no_plater};
$gui->MainLoop;
exit;
@@ -123,7 +125,6 @@ if (@ARGV) { # slicing from command line
if ($opt{repair}) {
foreach my $file (@ARGV) {
- $file = Slic3r::decode_path($file);
die "Repair is currently supported only on STL files\n"
if $file !~ /\.[sS][tT][lL]$/;
@@ -139,7 +140,6 @@ 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 $mesh = $model->mesh;
$mesh->translate(0, 0, -$mesh->bounding_box->z_min);
@@ -158,7 +158,6 @@ 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 $mesh = $model->mesh;
$mesh->repair;
@@ -167,14 +166,13 @@ if (@ARGV) { # slicing from command line
foreach my $new_mesh (@{$mesh->split}) {
my $output_file = sprintf '%s_%02d.stl', $file, ++$part_count;
printf "Writing to %s\n", basename($output_file);
- $new_mesh->write_binary(Slic3r::encode_path($output_file));
+ $new_mesh->write_binary($output_file);
}
}
exit;
}
while (my $input_file = shift @ARGV) {
- $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);