mirror of
https://github.com/Gabi-Zar/Silk-Fly-Launcher.git
synced 2026-04-17 05:26:04 +02:00
add auto path detection
This commit is contained in:
14
main.js
14
main.js
@@ -1,6 +1,7 @@
|
||||
const { app, BrowserWindow , ipcMain} = require('electron/main');
|
||||
const path = require('node:path');
|
||||
const Store = require('electron-store').default;
|
||||
const fs = require('fs/promises');
|
||||
|
||||
const store = new Store();
|
||||
|
||||
@@ -38,4 +39,17 @@ ipcMain.handle('save-path', (event, path) => {
|
||||
|
||||
ipcMain.handle('load-path', () => {
|
||||
return store.get('silksong-path');
|
||||
});
|
||||
|
||||
async function fileExists(filePath) {
|
||||
try {
|
||||
await fs.access(filePath);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
ipcMain.handle('file-exists', async (_, filePath) => {
|
||||
return await fileExists(filePath);
|
||||
});
|
||||
Reference in New Issue
Block a user