From 2ff8c4ec386a4977d4867b3f3604eb4582c3bda7 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Thu, 21 Apr 2022 19:58:51 -0700 Subject: [PATCH] automatically find game folder when launcher folder is selected --- resources/js/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/resources/js/index.js b/resources/js/index.js index 9bacc77..41298ed 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -366,7 +366,17 @@ async function setGenshinImpactFolder() { // Set the folder in our configuration const config = await getCfg() - config.genshinImpactFolder = folder + // See if the actual game folder is inside this one + const folderList = await Neutralino.filesystem.readDirectory(folder) + const gameFolder = folderList.filter(file => file.entry.includes('Genshin Impact Game')) + + if (gameFolder.length > 0) { + config.genshinImpactFolder = folder + '\\Genshin Impact Game' + Neutralino.storage.setData('config', JSON.stringify(config)) + } else { + config.genshinImpactFolder = folder + } + Neutralino.storage.setData('config', JSON.stringify(config)) // Refresh background and path