|
|
|
@ -1,8 +1,8 @@ |
|
|
|
|
"use strict"; |
|
|
|
|
const {app, protocol, dialog, ipcMain} = require("electron"); |
|
|
|
|
const path = require("path"); |
|
|
|
|
const fs = require("fs/promises"); |
|
|
|
|
const fsn = require("fs"); |
|
|
|
|
const {app, protocol, dialog, ipcMain, Menu} = require("electron"); |
|
|
|
|
const path = require("path"); |
|
|
|
|
const fs = require("fs/promises"); |
|
|
|
|
const fsn = require("fs"); |
|
|
|
|
|
|
|
|
|
const AppInfo = require("../package.json"); |
|
|
|
|
const WindowManager = require("./WindowManager"); |
|
|
|
@ -30,6 +30,7 @@ class Ation { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
ipcMain.handle("Ation::appVersion", () => AppInfo.version); |
|
|
|
|
ipcMain.on("Ation::closeFile", () => this.closeFile()); |
|
|
|
|
|
|
|
|
|
app.whenReady().then(async () => { |
|
|
|
|
if (this.fileToOpen) |
|
|
|
@ -79,12 +80,22 @@ class Ation { |
|
|
|
|
else |
|
|
|
|
this.openFile(this.currentFile, true); |
|
|
|
|
}); |
|
|
|
|
Menu.getApplicationMenu().getMenuItemById("close-file").enabled = this.currentFile !== ""; |
|
|
|
|
this.windowManager.mainWindow.send("Ation::openFile", [basePath, data]); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
closeFile() { |
|
|
|
|
this.currentFile = ""; |
|
|
|
|
if (this.watcher) |
|
|
|
|
this.watcher.close(); |
|
|
|
|
this.watcher = null; |
|
|
|
|
this.windowManager.mainWindow.send("Ation::closeFile"); |
|
|
|
|
Menu.getApplicationMenu().getMenuItemById("close-file").enabled = this.currentFile !== ""; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Ation.Instances = 0; |
|
|
|
|
|
|
|
|
|