Fix --output-prefix with input-files in sub-directories

And make sure to reserve the whole file path when not using --output-prefix.

Fixes https://sourceforge.net/p/flac/bugs/463/
Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com>
This commit is contained in:
orbea 2018-05-29 11:58:51 -07:00 committed by Erik de Castro Lopo
parent 01eb19708c
commit 5dff53c0cc
1 changed files with 20 additions and 2 deletions

View File

@ -2173,12 +2173,30 @@ int decode_file(const char *infilename)
const char *get_encoded_outfilename(const char *infilename)
{
const char *suffix = (option_values.use_ogg? ".oga" : ".flac");
return get_outfilename(infilename, suffix);
const char *p;
if(option_values.output_prefix) {
p = grabbag__file_get_basename(infilename);
}
else {
p = infilename;
}
return get_outfilename(p, suffix);
}
const char *get_decoded_outfilename(const char *infilename)
{
const char *suffix;
const char *p;
if(option_values.output_prefix) {
p = grabbag__file_get_basename(infilename);
}
else {
p = infilename;
}
if(option_values.analyze) {
suffix = ".ana";
}
@ -2197,7 +2215,7 @@ const char *get_decoded_outfilename(const char *infilename)
else {
suffix = ".wav";
}
return get_outfilename(infilename, suffix);
return get_outfilename(p, suffix);
}
const char *get_outfilename(const char *infilename, const char *suffix)