fixed out-dir problem
This commit is contained in:
parent
bf83e1cf0b
commit
9479741b75
2 changed files with 9 additions and 4 deletions
|
@ -107,6 +107,10 @@ on conflict(reader_url)
|
||||||
book.title
|
book.title
|
||||||
}`.replace(/[/]/g, "%2F");
|
}`.replace(/[/]/g, "%2F");
|
||||||
|
|
||||||
|
await fs.mkdir(opts.outDir, {
|
||||||
|
recursive: true,
|
||||||
|
});
|
||||||
|
|
||||||
const files = await fs.readdir(path);
|
const files = await fs.readdir(path);
|
||||||
|
|
||||||
if (files.every((f) => f.match(/[.](zip|cbz)$/))) {
|
if (files.every((f) => f.match(/[.](zip|cbz)$/))) {
|
||||||
|
@ -117,14 +121,15 @@ on conflict(reader_url)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [n, f] of Object.entries(files)) {
|
for (const [n, f] of Object.entries(files)) {
|
||||||
await fs.rename(
|
await fs.copyFile(
|
||||||
`${path}/${f}`,
|
`${path}/${f}`,
|
||||||
`${opts.outDir}/${title}${
|
`${opts.outDir}/${title}${
|
||||||
files.length > 1 ? ` - ${pad(n)}` : ""
|
files.length > 1 ? ` - ${pad(n)}` : ""
|
||||||
}.${f.split(".").at(-1)}`,
|
}.${f.split(".").at(-1)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await fs.rmdir(path);
|
|
||||||
|
await fs.rm(path, { recursive: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@fogtype/gadl",
|
"name": "@fogtype/gadl",
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@fogtype/gadl",
|
"name": "@fogtype/gadl",
|
||||||
"version": "1.4.1",
|
"version": "1.4.2",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fflate": "^0.8.1",
|
"fflate": "^0.8.1",
|
||||||
|
|
Loading…
Add table
Reference in a new issue