diff --git a/ivette/.gitignore b/ivette/.gitignore index 6478a7e46bb7c6e5cfc13819336b443f30ad189b..5137465dd358ebe9aa0f203fc100c0b4cae255b5 100644 --- a/ivette/.gitignore +++ b/ivette/.gitignore @@ -16,6 +16,6 @@ yarn-error.log /src/renderer/sandbox.ts /src/dome/doc/guides/icons.md /Makefile.plugins -/ivette.icns +/icon.icns # -------------------------------------------------------------------------- diff --git a/ivette/Makefile b/ivette/Makefile index 510191e354240fa786f2550c338a4112f574c819..1b2b102eff96614a7bd7dee48077ec582a50d37e 100644 --- a/ivette/Makefile +++ b/ivette/Makefile @@ -184,21 +184,21 @@ UNAME=$(shell uname) ifeq ($(UNAME),Darwin) -dome-dist: ivette.icns -ivette.icns: frama-c-icon.png - rm -fr ivette.iconset - mkdir ivette.iconset - sips -z 16 16 frama-c-icon.png --out "ivette.iconset/icon_16x16.png" - sips -z 32 32 frama-c-icon.png --out "ivette.iconset/icon_16x16@2x.png" - sips -z 32 32 frama-c-icon.png --out "ivette.iconset/icon_32x32.png" - sips -z 64 64 frama-c-icon.png --out "ivette.iconset/icon_32x32@2x.png" - sips -z 128 128 frama-c-icon.png --out "ivette.iconset/icon_128x128.png" - sips -z 256 256 frama-c-icon.png --out "ivette.iconset/icon_128x128@2x.png" - sips -z 256 256 frama-c-icon.png --out "ivette.iconset/icon_256x256.png" - sips -z 512 512 frama-c-icon.png --out "ivette.iconset/icon_256x256@2x.png" - sips -z 512 512 frama-c-icon.png --out "ivette.iconset/icon_512x512.png" - iconutil -c icns ivette.iconset - rm -fr ivette.iconset +dome-dist: icon.icns +icon.icns: static/icon.png + rm -fr icon.iconset + mkdir icon.iconset + sips -z 16 16 static/icon.png --out "icon.iconset/icon_16x16.png" + sips -z 32 32 static/icon.png --out "icon.iconset/icon_16x16@2x.png" + sips -z 32 32 static/icon.png --out "icon.iconset/icon_32x32.png" + sips -z 64 64 static/icon.png --out "icon.iconset/icon_32x32@2x.png" + sips -z 128 128 static/icon.png --out "icon.iconset/icon_128x128.png" + sips -z 256 256 static/icon.png --out "icon.iconset/icon_128x128@2x.png" + sips -z 256 256 static/icon.png --out "icon.iconset/icon_256x256.png" + sips -z 512 512 static/icon.png --out "icon.iconset/icon_256x256@2x.png" + sips -z 512 512 static/icon.png --out "icon.iconset/icon_512x512.png" + iconutil -c icns icon.iconset + rm -fr icon.iconset endif diff --git a/ivette/electron-builder.json b/ivette/electron-builder.json index 4f30f5348123abdd116a36ddcdaffc4faf807c9e..ff7514100edc044947d80466558bcb99ea87c78c 100644 --- a/ivette/electron-builder.json +++ b/ivette/electron-builder.json @@ -1,5 +1,5 @@ { - productName: "Ivette", - mac: { icon: "ivette.icns" }, - linux: { icon: "frama-c-icon.png" } + "productName": "Ivette", + "mac": { "icon": "icon.icns" }, + "linux": { "icon": "icon.png" } } diff --git a/ivette/src/dome/main/dome.ts b/ivette/src/dome/main/dome.ts index 6b77b3455661024d81ed75ec468d2de7e8daedf6..1203601813d1d92be77580251f38e7dc52968152 100644 --- a/ivette/src/dome/main/dome.ts +++ b/ivette/src/dome/main/dome.ts @@ -61,6 +61,11 @@ import SYS, * as System from 'dome/system'; import { URL } from 'url'; import * as Menubar from './menubar'; +// The __static path is provided by webpack at execution time, but the static +// type system is not aware of that for now. This is a workaround to avoid +// an error during compilation. +declare const __static: string; + // -------------------------------------------------------------------------- // --- System Helpers // -------------------------------------------------------------------------- @@ -388,6 +393,7 @@ function createBrowserWindow( const options: BrowserWindowConstructorOptions = { show: false, backgroundColor: '#f0f0f0', + icon: path.join(__static, 'icon.png'), webPreferences: { nodeIntegration: true, contextIsolation: false, diff --git a/ivette/src/dome/renderer/dome.tsx b/ivette/src/dome/renderer/dome.tsx index ef88eecd1347b1869aae951c17836273ca826b30..024312ea19fe57a61d2f2406bca112eeed664ceb 100644 --- a/ivette/src/dome/renderer/dome.tsx +++ b/ivette/src/dome/renderer/dome.tsx @@ -119,6 +119,16 @@ export function getWorkingDir(): string { return System.getWorkingDir(); } /** Current process ID.. */ export function getPID(): number { return System.getPID(); } +// The __static path is provided by webpack at execution time, but the static +// type system is not aware of that for now. This is a workaround to avoid +// an error during compilation. +declare const __static: string; + +/** Path to application static resources. */ +export function getStatic(file?: string): string { + return file ? System.join(__static, file) : __static; +} + // -------------------------------------------------------------------------- // --- Application Emitter // -------------------------------------------------------------------------- diff --git a/ivette/frama-c-icon.png b/ivette/static/icon.png similarity index 100% rename from ivette/frama-c-icon.png rename to ivette/static/icon.png