From daef0d1724f5839a181f760f829a04dac1261c4c Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 1 May 2022 22:23:33 -0700 Subject: [PATCH] ensure folders exist --- resources/js/gcdownloader.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/js/gcdownloader.js b/resources/js/gcdownloader.js index 29eb8a2..960a757 100644 --- a/resources/js/gcdownloader.js +++ b/resources/js/gcdownloader.js @@ -36,16 +36,21 @@ async function downloadGC(branch) { const serverFolderFixed = config.serverFolder.match(/.*\\|.*\//g, '')[0].replace(/\//g, '\\') + // Ensure data and key folders exist + + await Neutralino.os.execCommand(`mkdir ${serverFolderFixed}\\data`) + await Neutralino.os.execCommand(`mkdir ${serverFolderFixed}\\keys`) + // Download data files for (const o of dataList) { const folder = 'data' - Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) } - // Download each file + // Download key files for (const o of keyList) { const folder = 'keys' - Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) + await Neutralino.os.execCommand(`powershell Invoke-WebRequest -Uri ${o.url} -OutFile "${serverFolderFixed}\\${folder}\\${o.filename}"`) } return;