mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
fix bg getting on builds
This commit is contained in:
parent
77fbee5fbf
commit
8379dc898a
@ -1 +1 @@
|
|||||||
{"accessToken":"ToV6wKKVBBrgS1L3fMacE3Am--oguUf3t0dTffiCZjFQJFJE","port":52555}
|
{"accessToken":"CATm56pIp1rqIMWoVVw5y3RwLFjY48mCo01m0eRjbbUsOcF8","port":54022}
|
@ -32,11 +32,22 @@ async function setBackgroundImage() {
|
|||||||
const image = images[Math.floor(Math.random() * images.length)].entry
|
const image = images[Math.floor(Math.random() * images.length)].entry
|
||||||
const path = config.genshinImpactFolder.replace('\\', '/') + '/bg/' + image
|
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
|
// Copy to backgrounds folder
|
||||||
const bgs = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/')).filter(file => file.type === 'FILE')
|
const bgs = (await Neutralino.filesystem.readDirectory(NL_CWD + '/resources/bg/')).filter(file => file.type === 'FILE')
|
||||||
|
|
||||||
if (!bgs.find(file => file.entry === image)) {
|
if (!bgs.find(file => file.entry === image)) {
|
||||||
console.log('new file')
|
|
||||||
await Neutralino.filesystem.copyFile(path, NL_CWD + '/resources/bg/' + image)
|
await Neutralino.filesystem.copyFile(path, NL_CWD + '/resources/bg/' + image)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +63,9 @@ async function setGenshinImpactFolder() {
|
|||||||
|
|
||||||
config.genshinImpactFolder = folder
|
config.genshinImpactFolder = folder
|
||||||
Neutralino.storage.setData('config', JSON.stringify(config))
|
Neutralino.storage.setData('config', JSON.stringify(config))
|
||||||
|
|
||||||
|
// Refresh background
|
||||||
|
setBackgroundImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function launchOfficial() {
|
async function launchOfficial() {
|
||||||
@ -59,3 +73,11 @@ async function launchOfficial() {
|
|||||||
|
|
||||||
Neutralino.os.execCommand(config.genshinImpactFolder + '/Genshin Impact Game/GenshinImpact.exe')
|
Neutralino.os.execCommand(config.genshinImpactFolder + '/Genshin Impact Game/GenshinImpact.exe')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function launchPrivate() {
|
||||||
|
const ip = ''
|
||||||
|
const port = ''
|
||||||
|
|
||||||
|
const config = await getCfg()
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user