88 mkdirSync ,
99 mkdtempSync ,
1010 readFileSync ,
11- readdirSync ,
1211 rmSync ,
1312 statSync ,
1413 writeFileSync ,
@@ -20,7 +19,7 @@ import { fileURLToPath } from "node:url";
2019const isDevelopment = Boolean ( process . env . VITE_DEV_SERVER_URL ) ;
2120const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)" ;
2221const APP_BUNDLE_ID = isDevelopment ? "com.t3tools.t3code.dev" : "com.t3tools.t3code" ;
23- const LAUNCHER_VERSION = 1 ;
22+ const LAUNCHER_VERSION = 2 ;
2423
2524const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ;
2625export const desktopDir = resolve ( __dirname , ".." ) ;
@@ -121,40 +120,6 @@ function patchMainBundleInfoPlist(appBundlePath, iconPath) {
121120 copyFileSync ( iconPath , join ( resourcesDir , "electron.icns" ) ) ;
122121}
123122
124- function patchHelperBundleInfoPlists ( appBundlePath ) {
125- const frameworksDir = join ( appBundlePath , "Contents" , "Frameworks" ) ;
126- if ( ! existsSync ( frameworksDir ) ) {
127- return ;
128- }
129-
130- for ( const entry of readdirSync ( frameworksDir , { withFileTypes : true } ) ) {
131- if ( ! entry . isDirectory ( ) || ! entry . name . endsWith ( ".app" ) ) {
132- continue ;
133- }
134- if ( ! entry . name . startsWith ( "Electron Helper" ) ) {
135- continue ;
136- }
137-
138- const helperPlistPath = join ( frameworksDir , entry . name , "Contents" , "Info.plist" ) ;
139- if ( ! existsSync ( helperPlistPath ) ) {
140- continue ;
141- }
142-
143- const suffix = entry . name . replace ( "Electron Helper" , "" ) . replace ( ".app" , "" ) . trim ( ) ;
144- const helperName = suffix
145- ? `${ APP_DISPLAY_NAME } Helper ${ suffix } `
146- : `${ APP_DISPLAY_NAME } Helper` ;
147- const helperIdSuffix = suffix . replace ( / [ ( ) ] / g, "" ) . trim ( ) . toLowerCase ( ) . replace ( / \s + / g, "-" ) ;
148- const helperBundleId = helperIdSuffix
149- ? `${ APP_BUNDLE_ID } .helper.${ helperIdSuffix } `
150- : `${ APP_BUNDLE_ID } .helper` ;
151-
152- setPlistString ( helperPlistPath , "CFBundleDisplayName" , helperName ) ;
153- setPlistString ( helperPlistPath , "CFBundleName" , helperName ) ;
154- setPlistString ( helperPlistPath , "CFBundleIdentifier" , helperBundleId ) ;
155- }
156- }
157-
158123function readJson ( path ) {
159124 try {
160125 return JSON . parse ( readFileSync ( path , "utf8" ) ) ;
@@ -192,7 +157,6 @@ function buildMacLauncher(electronBinaryPath) {
192157 rmSync ( targetAppBundlePath , { recursive : true , force : true } ) ;
193158 cpSync ( sourceAppBundlePath , targetAppBundlePath , { recursive : true } ) ;
194159 patchMainBundleInfoPlist ( targetAppBundlePath , iconPath ) ;
195- patchHelperBundleInfoPlists ( targetAppBundlePath ) ;
196160 writeFileSync ( metadataPath , `${ JSON . stringify ( expectedMetadata , null , 2 ) } \n` ) ;
197161
198162 return targetBinaryPath ;
@@ -206,5 +170,11 @@ export function resolveElectronPath() {
206170 return electronBinaryPath ;
207171 }
208172
173+ // Dev launches do not need a renamed app bundle badly enough to risk breaking
174+ // Electron helper resource lookup on macOS.
175+ if ( isDevelopment ) {
176+ return electronBinaryPath ;
177+ }
178+
209179 return buildMacLauncher ( electronBinaryPath ) ;
210180}
0 commit comments