From fcb7f63c8758cb217c7e37728707a14979c2a0b7 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 20 Dec 2011 17:44:19 +0100 Subject: [PATCH] Added --ignore-nonexistent-config to allow integration with Pronterface even if config file doesn't exist --- README.markdown | 6 ++++-- slic3r.pl | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.markdown b/README.markdown index a3789675..73ffae17 100644 --- a/README.markdown +++ b/README.markdown @@ -188,9 +188,11 @@ Put this into *slicecommand*: And this into *sliceoptscommand*: - slic3r.pl --load config.ini + slic3r.pl --load config.ini --ignore-nonexistent-config -Replace `slic3r.pl` with the full path to the slic3r executable. +Replace `slic3r.pl` with the full path to the slic3r executable and `config.ini` +with the full path of your config file (put it in your home directory or where +you like). On Mac, the executable has a path like this: /Applications/Slic3r.app/Contents/MacOS/slic3r diff --git a/slic3r.pl b/slic3r.pl index 82c5b611..46e7e2e5 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -24,6 +24,7 @@ my %cli_options = (); 'save=s' => \$opt{save}, 'load=s' => \$opt{load}, + 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, ); foreach my $opt_key (keys %$Slic3r::Config::Options) { my $opt = $Slic3r::Config::Options->{$opt_key}; @@ -36,8 +37,11 @@ my %cli_options = (); # load configuration if ($opt{load}) { - -e $opt{load} or die "Cannot find specified configuration file.\n"; - Slic3r::Config->load($opt{load}); + if (-e $opt{load}) { + Slic3r::Config->load($opt{load}); + } else { + $opt{ignore_nonexistent_config} or die "Cannot find specified configuration file.\n"; + } } # validate command line options