提交
This commit is contained in:
@ -66,7 +66,7 @@ stopBatPath = process.platform === 'win32' ? stopBatPath.replace(/^(\w:)/, '/$1'
|
||||
// process.env.NODE_ENV === 'development'
|
||||
// ? `${join(app.getAppPath(), 'src/renderer/public/startUp/startUp.html')}`
|
||||
// : `file://${join(app.getAppPath(), 'resources/app.asar/out/renderer/startUp/startUp.html')}`
|
||||
|
||||
let isRestart = false
|
||||
function createWindow(): void {
|
||||
// Create the browser window.
|
||||
|
||||
@ -114,8 +114,12 @@ function createWindow(): void {
|
||||
}
|
||||
})
|
||||
ipcMain.on("restart", () => {
|
||||
app.relaunch();
|
||||
forceQuit();
|
||||
// app.relaunch();
|
||||
// app.quit();
|
||||
// cleanupProcess.kill();
|
||||
// app.relaunch();
|
||||
isRestart = true
|
||||
windowAllClosed()
|
||||
});
|
||||
// 监听启动页完成的消息
|
||||
ipcMain.on('splash-completed', () => {
|
||||
@ -173,6 +177,20 @@ function createWindow(): void {
|
||||
event.sender.send("selectedFileItem", path);
|
||||
});
|
||||
});
|
||||
ipcMain.handle('getIsFullScreen', () => {
|
||||
return mainWindow.isFullScreen()
|
||||
});
|
||||
ipcMain.on('toggle-fullscreen', (event) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
win!.setFullScreen(!win!.isFullScreen());
|
||||
});
|
||||
mainWindow.on('enter-full-screen', () => {
|
||||
mainWindow.webContents.send('fullscreen-status-changed', true)
|
||||
});
|
||||
|
||||
mainWindow.on('leave-full-screen', () => {
|
||||
mainWindow.webContents.send('fullscreen-status-changed', false)
|
||||
});
|
||||
|
||||
let recorder;
|
||||
ipcMain.on("startRecoder", () => {
|
||||
@ -212,9 +230,9 @@ function createWindow(): void {
|
||||
|
||||
// console.log('GetHomeDir()', GetHomeDir())
|
||||
let prefix =
|
||||
process.env.NODE_ENV === "development"
|
||||
? "src/renderer/public"
|
||||
: "resources/app.asar/out/renderer";
|
||||
process.env.NODE_ENV === "development"
|
||||
? "src/renderer/public"
|
||||
: "resources/app.asar/out/renderer";
|
||||
let data = {};
|
||||
for (const objKey in obj) {
|
||||
let files = fs.readdirSync(
|
||||
@ -415,9 +433,17 @@ function forceQuit() {
|
||||
// 终止所有剩余的子进程
|
||||
if (process.platform === 'win32') {
|
||||
// Windows系统特殊处理
|
||||
exec('taskkill /F /T /PID ' + process.pid, (error) => {
|
||||
// if (isRestart) {
|
||||
// isRestart = false
|
||||
// app.relaunch();
|
||||
// }
|
||||
let child = exec('taskkill /F /T /PID ' + process.pid, (error) => {
|
||||
if (error) console.error('强制终止失败:', error);
|
||||
child.kill();
|
||||
});
|
||||
if (isRestart) {
|
||||
app.relaunch();
|
||||
}
|
||||
} else {
|
||||
// 其他系统
|
||||
process.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user