mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
delete deprecated function
This commit is contained in:
@@ -30,7 +30,7 @@ ipcMain.on('bs-version.installed-versions', async (event, req: IpcRequest<void>)
|
||||
ipcMain.on("bs-version.open-folder", async (event, req: IpcRequest<BSVersion>) => {
|
||||
const localVersionService = BSLocalVersionService.getInstance();
|
||||
const versionFolder = await localVersionService.getVersionPath(req.args);
|
||||
UtilsService.getInstance().folderExist(versionFolder) && exec(`start "" "${versionFolder}"`);
|
||||
UtilsService.getInstance().pathExist(versionFolder) && exec(`start "" "${versionFolder}"`);
|
||||
});
|
||||
|
||||
ipcMain.on("bs-version.edit", async (event, req: IpcRequest<{version: BSVersion, name: string, color: string}>) => {
|
||||
|
||||
@@ -88,8 +88,6 @@ const createWindow = async () => {
|
||||
|
||||
UtilsService.getInstance().setMainWindow(mainWindow);
|
||||
|
||||
|
||||
|
||||
mainWindow.loadURL(resolveHtmlPath('index.html'));
|
||||
|
||||
mainWindow.on('ready-to-show', () => {
|
||||
|
||||
@@ -121,7 +121,7 @@ export class BSLocalVersionService{
|
||||
public async deleteVersion(version: BSVersion): Promise<boolean>{
|
||||
if(version.steam){ return false; }
|
||||
const versionFolder = await this.getVersionPath(version);
|
||||
if(!this.utilsService.folderExist(versionFolder)){ return true; }
|
||||
if(!this.utilsService.pathExist(versionFolder)){ return true; }
|
||||
|
||||
return this.utilsService.deleteFolder(versionFolder)
|
||||
.then(() => { return true; })
|
||||
|
||||
@@ -5,6 +5,7 @@ import path from "path";
|
||||
import { BrowserWindow } from "electron";
|
||||
import { rm } from "fs/promises";
|
||||
import { IpcResponse } from "shared/models/ipc";
|
||||
import log from "electron-log";
|
||||
|
||||
export class UtilsService{
|
||||
|
||||
@@ -29,13 +30,10 @@ export class UtilsService{
|
||||
|
||||
public setMainWindow(win: BrowserWindow){ this.mainWindow = win; }
|
||||
|
||||
//à supprimer
|
||||
public folderExist(path: string): boolean{ return existsSync(path); }
|
||||
|
||||
public pathExist(path: string): boolean{ return existsSync(path); }
|
||||
|
||||
public createFolderIfNotExist(path: string): void{
|
||||
if(!this.folderExist(path)){ mkdirSync(path, {recursive: true}); }
|
||||
if(!this.pathExist(path)){ mkdirSync(path, {recursive: true}); }
|
||||
}
|
||||
|
||||
public taskRunning(task: string): boolean{
|
||||
@@ -69,7 +67,11 @@ export class UtilsService{
|
||||
}
|
||||
|
||||
public ipcSend(channel: string, response: IpcResponse<any>): void{
|
||||
this.mainWindow.webContents.send(channel, response);
|
||||
try {
|
||||
this.mainWindow.webContents.send(channel, response);
|
||||
} catch (error) {
|
||||
log.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user