From 4ca85b14bb867397a9ff2a957f5b6e4eb24a4eca Mon Sep 17 00:00:00 2001 From: Felix Rieseberg <4345955+adriaticaz9@users.noreply.github.com> Date: Sat, 2 Sep 2023 11:27:31 -0700 Subject: [PATCH] Fix: Create target directory when copying (#1030) Fix: Allow building with space in path --- deps/copy.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deps/copy.js b/deps/copy.js index 42ce4e61..56285e60 100644 --- a/deps/copy.js +++ b/deps/copy.js @@ -21,6 +21,13 @@ for (const { filename, optional } of files) { if (optional && !fs.existsSync(path.join(source, filename))) { continue; } + fs.accessSync(path.join(source, filename)); + + // Ensure destination folder exists + const destFolder = path.dirname(path.join(dest, filename)); + fs.mkdirSync(destFolder, { recursive: true }); + + // Copy file over fs.copyFileSync(path.join(source, filename), path.join(dest, filename)); }