Make --output accept directories. #535

This commit is contained in:
Henrik Brix Andersen 2012-08-01 17:12:16 +02:00
parent deaa188630
commit 0e620f3ad2
3 changed files with 8 additions and 4 deletions

View file

@ -87,8 +87,8 @@ The author of the Silk icon set is Mark James.
--save <file> Save configuration to the specified file --save <file> Save configuration to the specified file
--load <file> Load configuration from the specified file. It can be used --load <file> Load configuration from the specified file. It can be used
more than once to load options from multiple files. 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 or directory to output gcode to (by default, the file will be
into the same directory as the input file using the saved into the same directory as the input file using the
--output-filename-format to generate the filename) --output-filename-format to generate the filename)
-j, --threads <num> Number of threads to use (1+, default: 2) -j, --threads <num> Number of threads to use (1+, default: 2)

View file

@ -775,6 +775,10 @@ sub expanded_output_filepath {
my $self = shift; my $self = shift;
my ($path) = @_; my ($path) = @_;
# if output path is an existing directory, we take that and append
# the specified filename format
$path = File::Spec->join($path, $Slic3r::Config->output_filename_format) if ($path && -d $path);
# if no explicit output file was defined, we take the input # if no explicit output file was defined, we take the input
# file directory and append the specified filename format # file directory and append the specified filename format
my $input_file = $self->objects->[0]->input_file; my $input_file = $self->objects->[0]->input_file;

View file

@ -11,10 +11,10 @@ _arguments -S \
'(- *)--version[output the version of Slic3r and exit]' \ '(- *)--version[output the version of Slic3r and exit]' \
'--save[save configuration to file]:config output file:_files -g "*.(#i)ini(-.)"' \ '--save[save configuration to file]:config output file:_files -g "*.(#i)ini(-.)"' \
'*--load[load configuration from file]:config input file:_files -g "*.(#i)ini(-.)"' \ '*--load[load configuration from file]:config input file:_files -g "*.(#i)ini(-.)"' \
'(--output -o --output-filename-format)'{--output,-o}'[specify output file]:output file:_files -g "*.(#i)(gcode|svg)(-.)"' \ '(--output -o)'{--output,-o}'[specify output file]:output file:_files -g "*.(#i)(gcode|svg)(-.)"' \
'(--threads -j)'{--threads,-j}'[specify number of threads to use]:number of threads' \ '(--threads -j)'{--threads,-j}'[specify number of threads to use]:number of threads' \
\ \
'(--output -o)--output-filename-format[specify output filename format]:output filename format' \ '--output-filename-format[specify output filename format]:output filename format' \
'*--post-process[specify post-processing script]:post-processing script file:_files' \ '*--post-process[specify post-processing script]:post-processing script file:_files' \
'--export-svg[export SVG containing slices instead of G-code]' \ '--export-svg[export SVG containing slices instead of G-code]' \
'(--merge -m)'{--merge,-m}'[merge multiple input files into a single print]' \ '(--merge -m)'{--merge,-m}'[merge multiple input files into a single print]' \