#12: Fix config-sample path

This commit is contained in:
Elian Doran 2024-05-11 22:45:30 +03:00
parent 3360b9769f
commit 2da9a2b03a
No known key found for this signature in database
2 changed files with 8 additions and 2 deletions

View File

@ -14,15 +14,21 @@ async function copyNodeModuleFileOrFolder(source: string) {
await fs.copy(source, destination); 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) { function trimRelativePath(path: string) {
return path.replace(/\.\.\//g, "") return path.replace(/\.\.\//g, "")
} }
async function copyFiles() { async function copyFiles() {
const filesToCopy = ["config-sample.ini"]; const filesToCopy = ["../server/config-sample.ini"];
for (const file of filesToCopy) { for (const file of filesToCopy) {
console.log(`Copying ${file}`); console.log(`Copying ${file}`);
await fs.copy(file, path.join(DEST_DIR, file)); await fs.copy(file, path.join(DEST_DIR, trimRelativePath(file)));
} }
} }