From 2da9a2b03aa5f76872291ea6bcb7c0be837444f9 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 11 May 2024 22:45:30 +0300 Subject: [PATCH] #12: Fix config-sample path --- electron/bin/copy-dist.ts | 10 ++++++++-- electron/{ => server}/config-sample.ini | 0 2 files changed, 8 insertions(+), 2 deletions(-) rename electron/{ => server}/config-sample.ini (100%) diff --git a/electron/bin/copy-dist.ts b/electron/bin/copy-dist.ts index 0bc4f57ad..78f09a1a3 100644 --- a/electron/bin/copy-dist.ts +++ b/electron/bin/copy-dist.ts @@ -14,15 +14,21 @@ async function copyNodeModuleFileOrFolder(source: string) { await fs.copy(source, destination); } +/** + * Removes all "../" components from a given path. + * + * @param path the path with relative components + * @returns the modified path. + */ function trimRelativePath(path: string) { return path.replace(/\.\.\//g, "") } async function copyFiles() { - const filesToCopy = ["config-sample.ini"]; + const filesToCopy = ["../server/config-sample.ini"]; for (const file of filesToCopy) { console.log(`Copying ${file}`); - await fs.copy(file, path.join(DEST_DIR, file)); + await fs.copy(file, path.join(DEST_DIR, trimRelativePath(file))); } } diff --git a/electron/config-sample.ini b/electron/server/config-sample.ini similarity index 100% rename from electron/config-sample.ini rename to electron/server/config-sample.ini