Spaces in file path #22

This commit is contained in:
garronej
2021-07-21 22:42:00 +02:00
parent a1bec78ea2
commit b1e24212ea
3 changed files with 49 additions and 6 deletions

View File

@ -3,6 +3,7 @@ import { basename as pathBasename, join as pathJoin } from "path";
import { execSync } from "child_process";
import fs from "fs";
import { transformCodebase } from "../tools/transformCodebase";
import { rm_rf, rm, rm_r } from "./rm";
/** assert url ends with .zip */
export function downloadAndUnzip(
@ -16,19 +17,19 @@ export function downloadAndUnzip(
const tmpDirPath = pathJoin(destDirPath, "..", "tmp_xxKdOxnEdx");
execSync(`rm -rf ${tmpDirPath}`);
rm_rf(tmpDirPath);
fs.mkdirSync(tmpDirPath, { "recursive": true });
execSync(`wget ${url}`, { "cwd": tmpDirPath })
execSync(`unzip ${pathBasename(url)}`, { "cwd": tmpDirPath });
execSync(`rm ${pathBasename(url)}`, { "cwd": tmpDirPath });
rm(pathBasename(url), { "cwd": tmpDirPath });
transformCodebase({
"srcDirPath": tmpDirPath,
"destDirPath": destDirPath,
});
execSync(`rm -r ${tmpDirPath}`);
rm_r(tmpDirPath);
}