From 8379dc898ad6fd24da256a016bc1f8f881088c34 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Tue, 19 Apr 2022 18:40:05 -0700 Subject: [PATCH] fix bg getting on builds --- .tmp/auth_info.json | 2 +- resources/js/index.js | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.tmp/auth_info.json b/.tmp/auth_info.json index db9fe19..9bc13bd 100644 --- a/.tmp/auth_info.json +++ b/.tmp/auth_info.json @@ -1 +1 @@ -{"accessToken":"ToV6wKKVBBrgS1L3fMacE3Am--oguUf3t0dTffiCZjFQJFJE","port":52555} \ No newline at end of file +{"accessToken":"CATm56pIp1rqIMWoVVw5y3RwLFjY48mCo01m0eRjbbUsOcF8","port":54022} \ No newline at end of file diff --git a/resources/js/index.js b/resources/js/index.js index 785e145..9e80959 100644 --- a/resources/js/index.js +++ b/resources/js/index.js @@ -32,11 +32,22 @@ async function setBackgroundImage() { const image = images[Math.floor(Math.random() * images.length)].entry const path = config.genshinImpactFolder.replace('\\', '/') + '/bg/' + image + // Check if resources folder exists + const mainDir = await Neutralino.filesystem.readDirectory(NL_CWD) + if (!mainDir.find(dir => dir.entry === 'resources')) { + await Neutralino.filesystem.createDirectory(NL_CWD + '/resources') + } + + // Ensure bg folder exists + const bgDir = await Neutralino.filesystem.readDirectory(NL_CWD + '/resources') + if (!bgDir.find(dir => dir.entry === 'bg')) { + await Neutralino.filesystem.createDirectory(NL_CWD + '/resources/bg') + } + // Copy to backgrounds folder const bgs = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/')).filter(file => file.type === 'FILE') if (!bgs.find(file => file.entry === image)) { - console.log('new file') await Neutralino.filesystem.copyFile(path, NL_CWD + '/resources/bg/' + image) } @@ -52,10 +63,21 @@ async function setGenshinImpactFolder() { config.genshinImpactFolder = folder Neutralino.storage.setData('config', JSON.stringify(config)) + + // Refresh background + setBackgroundImage() } async function launchOfficial() { const config = await getCfg() Neutralino.os.execCommand(config.genshinImpactFolder + '/Genshin Impact Game/GenshinImpact.exe') +} + +async function launchPrivate() { + const ip = '' + const port = '' + + const config = await getCfg() + } \ No newline at end of file