diff --git a/README.markdown b/README.markdown index cb7a50cda..ca0d9a6ff 100644 --- a/README.markdown +++ b/README.markdown @@ -87,8 +87,8 @@ The author of the Silk icon set is Mark James. --save Save configuration to the specified file --load Load configuration from the specified file. It can be used more than once to load options from multiple files. - -o, --output File to output gcode to (by default, the file will be saved - into the same directory as the input file using the + -o, --output File or directory to output gcode to (by default, the file will be + saved into the same directory as the input file using the --output-filename-format to generate the filename) -j, --threads Number of threads to use (1+, default: 2) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 6cedfe7d6..3e81300d2 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -775,6 +775,10 @@ sub expanded_output_filepath { my $self = shift; 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 # file directory and append the specified filename format my $input_file = $self->objects->[0]->input_file; diff --git a/utils/zsh/functions/_slic3r b/utils/zsh/functions/_slic3r index 16d32e0eb..384c812a5 100644 --- a/utils/zsh/functions/_slic3r +++ b/utils/zsh/functions/_slic3r @@ -11,10 +11,10 @@ _arguments -S \ '(- *)--version[output the version of Slic3r and exit]' \ '--save[save configuration to file]:config output 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' \ \ - '(--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' \ '--export-svg[export SVG containing slices instead of G-code]' \ '(--merge -m)'{--merge,-m}'[merge multiple input files into a single print]' \