open game and grasscutter folders from launcher

This commit is contained in:
SpikeHD 2022-04-26 02:12:58 -07:00
parent 1ecb69af38
commit 2ab0fb75f9
3 changed files with 17 additions and 3 deletions

View File

@ -130,14 +130,14 @@
<div> <div>
<div> <div>
<button class="smolBtn" onclick="setGameExe()" id="gameExeSet">Set game folder</button> <button class="smolBtn" onclick="setGameExe()" id="gameExeSet">Set game folder</button>
<img src="icons/folder.svg" class="openFolderIcon" id="openGameFolder()"/> <img src="icons/folder.svg" class="openFolderIcon" onclick="openGameFolder()"/>
</div> </div>
<span id="gamePath" style="margin-top: 4px;"></span> <span id="gamePath" style="margin-top: 4px;"></span>
</div> </div>
<div style="display: none;"> <div style="display: none;">
<div> <div>
<button class="smolBtn" onclick="setGrasscutterFolder()" id="grasscutterFileSet">Set "Grasscutter" .jar file</button> <button class="smolBtn" onclick="setGrasscutterFolder()" id="grasscutterFileSet">Set "Grasscutter" .jar file</button>
<img src="icons/folder.svg" class="openFolderIcon" id="openGrasscutterFolder()"/> <img src="icons/folder.svg" class="openFolderIcon" onclick="openGrasscutterFolder()"/>
</div> </div>
<span id="serverPath" style="margin-top: 4px;"></span> <span id="serverPath" style="margin-top: 4px;"></span>
</div> </div>

View File

@ -57,6 +57,20 @@ async function proxyIsInstalled() {
return false return false
} }
async function openGameFolder() {
const config = await getCfg()
const folder = config.gameexe.match(/.*\\/g, '')[0]
createCmdWindow(`explorer.exe "${folder}"`)
}
async function openGrasscutterFolder() {
const config = await getCfg()
const folder = config.serverFolder.match(/.*\\/g, '')[0]
createCmdWindow(`explorer.exe "${folder}"`)
}
/** /**
* Minimize the window * Minimize the window
*/ */

View File

@ -366,7 +366,7 @@ async function setGrasscutterFolder() {
// Set the folder in our configuration // Set the folder in our configuration
const config = await getCfg() const config = await getCfg()
config.serverFolder = folder config.serverFolder = folder[0]
Neutralino.storage.setData('config', JSON.stringify(config)) Neutralino.storage.setData('config', JSON.stringify(config))
displayServerFolder() displayServerFolder()