@@ -20,14 +20,14 @@ export const APP_BUNDLE_ID = isDevelopment
2020 ? `com.t3tools.t3code.dev.${ devBundleIdSuffix || "local" } `
2121 : "com.t3tools.t3code" ;
2222const APP_PROTOCOL_SCHEMES = isDevelopment ? [ "t3code-dev" ] : [ "t3code" ] ;
23- const LAUNCHER_VERSION = 14 ;
24- const defaultIconPath = NodePath . join ( desktopDir , "resources" , "icon.icns" ) ;
23+ const LAUNCHER_VERSION = 15 ;
2524const developmentMacIconPngPath = NodePath . join (
2625 repoRoot ,
2726 "assets" ,
2827 "dev" ,
2928 "blueprint-macos-1024.png" ,
3029) ;
30+ const productionMacIconPngPath = NodePath . join ( repoRoot , "assets" , "prod" , "black-macos-1024.png" ) ;
3131// oxlint-disable-next-line t3code/no-global-process-runtime -- Standalone launcher script has no Effect runtime.
3232const hostPlatform = NodeOS . platform ( ) ;
3333
@@ -165,15 +165,22 @@ function registerMacLauncherBundle(appBundlePath) {
165165 }
166166}
167167
168- function ensureDevelopmentIconIcns ( runtimeDir ) {
169- const generatedIconPath = NodePath . join ( runtimeDir , "icon-dev.icns" ) ;
168+ export function resolveMacLauncherIconPaths ( runtimeDir , development = isDevelopment ) {
169+ return {
170+ sourceIconPath : development ? developmentMacIconPngPath : productionMacIconPngPath ,
171+ generatedIconPath : NodePath . join ( runtimeDir , development ? "icon-dev.icns" : "icon-prod.icns" ) ,
172+ } ;
173+ }
174+
175+ function ensureMacIconIcns ( runtimeDir ) {
176+ const { sourceIconPath, generatedIconPath } = resolveMacLauncherIconPaths ( runtimeDir ) ;
170177 NodeFS . mkdirSync ( runtimeDir , { recursive : true } ) ;
171178
172- if ( ! NodeFS . existsSync ( developmentMacIconPngPath ) ) {
173- return defaultIconPath ;
179+ if ( ! NodeFS . existsSync ( sourceIconPath ) ) {
180+ throw new Error ( `Desktop macOS icon source is missing at ${ sourceIconPath } ` ) ;
174181 }
175182
176- const sourceMtimeMs = NodeFS . statSync ( developmentMacIconPngPath ) . mtimeMs ;
183+ const sourceMtimeMs = NodeFS . statSync ( sourceIconPath ) . mtimeMs ;
177184 if (
178185 NodeFS . existsSync ( generatedIconPath ) &&
179186 NodeFS . statSync ( generatedIconPath ) . mtimeMs >= sourceMtimeMs
@@ -191,7 +198,7 @@ function ensureDevelopmentIconIcns(runtimeDir) {
191198 "-z" ,
192199 String ( size ) ,
193200 String ( size ) ,
194- developmentMacIconPngPath ,
201+ sourceIconPath ,
195202 "--out" ,
196203 NodePath . join ( iconsetDir , `icon_${ size } x${ size } .png` ) ,
197204 ] ) ;
@@ -201,20 +208,14 @@ function ensureDevelopmentIconIcns(runtimeDir) {
201208 "-z" ,
202209 String ( retinaSize ) ,
203210 String ( retinaSize ) ,
204- developmentMacIconPngPath ,
211+ sourceIconPath ,
205212 "--out" ,
206213 NodePath . join ( iconsetDir , `icon_${ size } x${ size } @2x.png` ) ,
207214 ] ) ;
208215 }
209216
210217 runChecked ( "iconutil" , [ "-c" , "icns" , iconsetDir , "-o" , generatedIconPath ] ) ;
211218 return generatedIconPath ;
212- } catch ( error ) {
213- console . warn (
214- "[desktop-launcher] Failed to generate dev macOS icon, falling back to default icon." ,
215- error ,
216- ) ;
217- return defaultIconPath ;
218219 } finally {
219220 NodeFS . rmSync ( iconsetRoot , { recursive : true , force : true } ) ;
220221 }
@@ -297,7 +298,7 @@ function buildMacLauncher(electronBinaryPath) {
297298 const launcherBinaryPath = isDevelopment
298299 ? developmentPaths . launcherBinaryPath
299300 : runtimeElectronBinaryPath ;
300- const iconPath = isDevelopment ? ensureDevelopmentIconIcns ( runtimeDir ) : defaultIconPath ;
301+ const iconPath = ensureMacIconIcns ( runtimeDir ) ;
301302 const metadataPath = NodePath . join ( runtimeDir , "metadata.json" ) ;
302303
303304 NodeFS . mkdirSync ( runtimeDir , { recursive : true } ) ;
0 commit comments