Allow multiple --load options

degen-loop-screen
Alessandro Ranellucci 2012-01-23 11:57:03 +01:00
parent 5bc3f2cfa5
commit d63fd77da4
1 changed files with 12 additions and 9 deletions

View File

@ -23,7 +23,7 @@ my %cli_options = ();
'o|output=s' => \$opt{output}, 'o|output=s' => \$opt{output},
'save=s' => \$opt{save}, 'save=s' => \$opt{save},
'load=s' => \$opt{load}, 'load=s@' => \$opt{load},
'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config}, 'ignore-nonexistent-config' => \$opt{ignore_nonexistent_config},
); );
foreach my $opt_key (keys %$Slic3r::Config::Options) { foreach my $opt_key (keys %$Slic3r::Config::Options) {
@ -37,13 +37,15 @@ my %cli_options = ();
# load configuration # load configuration
if ($opt{load}) { if ($opt{load}) {
if (-e $opt{load}) { foreach my $configfile (@{$opt{load}}) {
Slic3r::Config->load($opt{load}); if (-e $configfile) {
} elsif (-e "$FindBin::Bin/$opt{load}") { Slic3r::Config->load($configfile);
printf STDERR "Loaded $FindBin::Bin/$opt{load}\n"; } elsif (-e "$FindBin::Bin/$configfile") {
Slic3r::Config->load("$FindBin::Bin/$opt{load}"); printf STDERR "Loading $FindBin::Bin/$configfile\n";
} else { Slic3r::Config->load("$FindBin::Bin/$configfile");
$opt{ignore_nonexistent_config} or die "Cannot find specified configuration file.\n"; } else {
$opt{ignore_nonexistent_config} or die "Cannot find specified configuration file ($configfile).\n";
}
} }
} }
@ -94,7 +96,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl
--help Output this usage screen and exit --help Output this usage screen and exit
--save <file> Save configuration to the specified file --save <file> Save configuration to the specified file
--load <file> Load configuration from the specified file --load <file> Load configuration from the specified file. It can be used
more than once to load options from multiple files.
-o, --output <file> File to output gcode to (by default, the file will be saved -o, --output <file> File to output gcode to (by default, the file will be saved
into the same directory as the input file using the into the same directory as the input file using the
--output-filename-format to generate the filename) --output-filename-format to generate the filename)