mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-25 11:43:17 +01:00
try to fix #286
This commit is contained in:
parent
8eff811409
commit
610a233f8a
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -8,8 +8,8 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
# os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
os: [windows-latest]
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
# os: [windows-latest]
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
|
@ -1,6 +1,6 @@
|
||||
const electron = require('electron'); // eslint-disable-line
|
||||
const isDev = require('electron-is-dev');
|
||||
const path = require('path');
|
||||
const { join } = require('path');
|
||||
|
||||
const menu = require('./menu');
|
||||
|
||||
@ -16,6 +16,11 @@ app.name = 'LosslessCut';
|
||||
let mainWindow;
|
||||
|
||||
let askBeforeClose = false;
|
||||
let rendererReady = false;
|
||||
|
||||
function openFile(path) {
|
||||
mainWindow.webContents.send('file-opened', [path]);
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
mainWindow = new BrowserWindow({
|
||||
@ -27,7 +32,7 @@ function createWindow() {
|
||||
},
|
||||
});
|
||||
|
||||
mainWindow.loadURL(isDev ? 'http://localhost:3001' : `file://${path.join(__dirname, '../build/index.html')}`);
|
||||
mainWindow.loadURL(isDev ? 'http://localhost:3001' : `file://${join(__dirname, '../build/index.html')}`);
|
||||
|
||||
if (isDev) {
|
||||
const { default: installExtension, REACT_DEVELOPER_TOOLS } = require('electron-devtools-installer'); // eslint-disable-line global-require,import/no-extraneous-dependencies
|
||||
@ -92,12 +97,21 @@ app.on('activate', () => {
|
||||
}
|
||||
});
|
||||
|
||||
let openFileInitial;
|
||||
|
||||
electron.ipcMain.on('renderer-ready', () => {
|
||||
rendererReady = true;
|
||||
if (!isDev) {
|
||||
const fileToOpen = process.argv[1];
|
||||
// https://github.com/electron/electron/issues/3657
|
||||
if (fileToOpen && !fileToOpen.startsWith('-psn_')) mainWindow.webContents.send('file-opened', [fileToOpen]);
|
||||
if (fileToOpen && !fileToOpen.startsWith('-psn_')) openFile(fileToOpen);
|
||||
}
|
||||
if (openFileInitial) openFile(openFileInitial);
|
||||
});
|
||||
|
||||
app.on('open-file', (event, path) => {
|
||||
if (rendererReady) openFile(path);
|
||||
else openFileInitial = path;
|
||||
});
|
||||
|
||||
electron.ipcMain.on('setAskBeforeClose', (e, val) => {
|
||||
|
Loading…
Reference in New Issue
Block a user