// Permissive licenses: These impose minimal requirements (mostly attribution + license notice). You can generally use them interchangeably in commercial and proprietary software.
MIT: true,
'BSD-2-Clause':true,
'BSD-3-Clause':true,
ISC: true,
Zlib: true,
'Python-2.0':true,
'BlueOak-1.0.0':true,
// Permissive licenses with some conditions
'Apache-2.0':true,
// Copyleft licenses: These require that derivative works be distributed under the same license terms. They ensure that modifications remain open source.
// which is OK because LosslessCut is also GPL-2.0-only
'GPL-2.0-only':['lossless-cut'],
// Weak copyleft licenses: These allow linking with proprietary software under certain conditions, making them more flexible than strong copyleft licenses.
// On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.
// However when users start your app in command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure single instance.
// This can be tested with one terminal: npx electron .
// and another terminal: npx electron . path/to/file.mp4
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if(mainWindow===null){
createWindow();
}
});
ipcMain.on('renderer-ready',()=>{
rendererReady=true;
if(filesToOpen.length>0)openFiles(filesToOpen);
});
// Mac OS open with LosslessCut
// Emitted when the user wants to open a file with the application. The open-file event is usually emitted when the application is already open and the OS wants to reuse the application to open the file.
app.on('open-file',(event,path)=>{
openFilesEventually([path]);
event.preventDefault();// recommended in docs https://www.electronjs.org/docs/latest/api/app#event-open-file-macos
});
ipcMain.on('setAskBeforeClose',(_e,val)=>{
askBeforeClose=val;
});
ipcMain.on('setLanguage',(_e,language)=>{
i18n.changeLanguage(language).then(()=>updateMenu()).catch((err)=>logger.error('Failed to set language',err));
// On macOS, the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that.
// However when users start your app in command line, the system's single instance mechanism will be bypassed, and you have to use this method to ensure single instance.
// This can be tested with one terminal: npx electron .
// and another terminal: npx electron . path/to/file.mp4
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if(mainWindow===null){
createWindow();
}
});
ipcMain.on('renderer-ready',()=>{
rendererReady=true;
if(filesToOpen.length>0)openFiles(filesToOpen);
});
// Mac OS open with LosslessCut
// Emitted when the user wants to open a file with the application. The open-file event is usually emitted when the application is already open and the OS wants to reuse the application to open the file.
app.on('open-file',(event,path)=>{
openFilesEventually([path]);
event.preventDefault();// recommended in docs https://www.electronjs.org/docs/latest/api/app#event-open-file-macos
});
ipcMain.on('setAskBeforeClose',(_e,val)=>{
askBeforeClose=val;
});
ipcMain.on('setLanguage',(_e,language)=>{
i18n.changeLanguage(language).then(()=>updateMenu()).catch((err)=>logger.error('Failed to set language',err));
// Note: MAS only allows fs.stat (fs-extra.exists) if we don't have access to input dir yet
if(!(awaitexists(mediaFilePath))){
// Note: MAS only allows fs.stat (pathExists) if we don't have access to input dir yet
if(!(awaitpathExists(mediaFilePath))){
errorToast(i18n.t('The media file referenced by the project file you tried to open does not exist in the same directory as the project file: {{mediaFileName}}',{mediaFileName}));