delete deprecated function

This commit is contained in:
MathieuG-P
2022-07-24 11:07:00 +02:00
parent 6bb0d26bac
commit da23586ad3
4 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -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}>) => {
-2
View File
@@ -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; })
+7 -5
View File
@@ -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);
}
}
}