Commit 5dff53c0 authored by orbea's avatar orbea Committed by Erik de Castro Lopo

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's avatarErik de Castro Lopo <erikd@mega-nerd.com>
parent 01eb1970
...@@ -2173,12 +2173,30 @@ int decode_file(const char *infilename) ...@@ -2173,12 +2173,30 @@ int decode_file(const char *infilename)
const char *get_encoded_outfilename(const char *infilename) const char *get_encoded_outfilename(const char *infilename)
{ {
const char *suffix = (option_values.use_ogg? ".oga" : ".flac"); 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 *get_decoded_outfilename(const char *infilename)
{ {
const char *suffix; const char *suffix;
const char *p;
if(option_values.output_prefix) {
p = grabbag__file_get_basename(infilename);
}
else {
p = infilename;
}
if(option_values.analyze) { if(option_values.analyze) {
suffix = ".ana"; suffix = ".ana";
} }
...@@ -2197,7 +2215,7 @@ const char *get_decoded_outfilename(const char *infilename) ...@@ -2197,7 +2215,7 @@ const char *get_decoded_outfilename(const char *infilename)
else { else {
suffix = ".wav"; suffix = ".wav";
} }
return get_outfilename(infilename, suffix); return get_outfilename(p, suffix);
} }
const char *get_outfilename(const char *infilename, const char *suffix) const char *get_outfilename(const char *infilename, const char *suffix)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment