From 188d3232ea761644c85e105e39e2292682dcf957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Perrin?= Date: Mon, 29 Jun 2026 15:31:04 +0200 Subject: [PATCH] Fix adept_remove -O placing result in a nested sub-directory With -O , 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. --- utils/adept_remove.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/utils/adept_remove.cpp b/utils/adept_remove.cpp index 47112ab..b48bb07 100644 --- a/utils/adept_remove.cpp +++ b/utils/adept_remove.cpp @@ -88,7 +88,12 @@ public: filename = std::string(inputFile); if (outputDir) - filename = std::string(outputDir) + "/" + filename; + { + std::string _in(inputFile); + size_t _pos = _in.find_last_of('/'); + std::string _base = (_pos == std::string::npos) ? _in : _in.substr(_pos + 1); + filename = std::string(outputDir) + "/" + _base; + } } if (endsWith(filename, ".epub"))