mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-01-09 00:21:10 +00:00
Fix 'Image could not be created' app error on run (fix #992)
Electron 9.x now crashes when passed a non-existent icon. Also, it accepts both ico and png. So, do our best to pass it a file that exists.
This commit is contained in:
parent
e592c6bca6
commit
f23447312d
@ -63,7 +63,19 @@ export function debugLog(browserWindow: BrowserWindow, message: string): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getAppIcon(): string {
|
export function getAppIcon(): string {
|
||||||
return path.join(__dirname, '..', `icon.${isWindows() ? 'ico' : 'png'}`);
|
// Prefer ICO under Windows, see
|
||||||
|
// https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions
|
||||||
|
// https://www.electronjs.org/docs/api/native-image#supported-formats
|
||||||
|
if (isWindows()) {
|
||||||
|
const ico = path.join(__dirname, '..', 'icon.ico');
|
||||||
|
if (fs.existsSync(ico)) {
|
||||||
|
return ico;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const png = path.join(__dirname, '..', 'icon.png');
|
||||||
|
if (fs.existsSync(png)) {
|
||||||
|
return png;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function nativeTabsSupported(): boolean {
|
export function nativeTabsSupported(): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user