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
@@ -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);
}
}
}