Fix adept_remove -O placing result in a nested sub-directory

With -O <dir>, the output path was built from the full input path
instead of its base name:

    filename = std::string(inputFile);
    if (outputDir)
        filename = std::string(outputDir) + "/" + filename;

So `adept_remove -O /out /tmp/x/book.epub` wrote the result to
/out/tmp/x/book.epub (createPath() silently creating the intermediate
directories) instead of /out/book.epub.

-O is documented as the directory "were to put result", so only the
input's base name should be appended. acsmdownloader is unaffected
because it derives its output name from the title metadata, not from
the input path.

Reduce the input to its base name before prefixing it with -O.
This commit was merged in pull request #29.
This commit is contained in:
2026-06-29 15:31:04 +02:00
parent 324c566756
commit 1abb470819
+5 -1
View File
@@ -88,7 +88,11 @@ public:
filename = std::string(inputFile); filename = std::string(inputFile);
if (outputDir) if (outputDir)
filename = std::string(outputDir) + "/" + filename; {
char* basepath = strdup(inputFile);
filename = std::string(outputDir) + "/" + basename(basepath);
free(basepath);
}
} }
if (endsWith(filename, ".epub")) if (endsWith(filename, ".epub"))