@@ -16,6 +16,25 @@ const gotTheLock = app.requestSingleInstanceLock();
1616if ( ! gotTheLock ) {
1717 // Another instance is running, quit this one immediately
1818 app . quit ( ) ;
19+ // Return value is ignored but this stops further module execution
20+ return ;
21+ }
22+
23+ function getPhNodePath ( ) {
24+ if ( ! app . isPackaged ) {
25+ return path . resolve ( __dirname , 'bin' , 'phnode' ) ;
26+ }
27+ // extraResources places files directly in resources/
28+ return path . join ( process . resourcesPath , 'bin' , 'phnode' ) ;
29+ }
30+
31+ function getSrcNodePath ( ) {
32+ if ( ! app . isPackaged ) {
33+ // Dev: use phoenix repo's src-node
34+ return path . resolve ( __dirname , '..' , '..' , 'phoenix' , 'src-node' ) ;
35+ }
36+ // extraResources places files directly in resources/
37+ return path . join ( process . resourcesPath , 'src-node' ) ;
1938}
2039
2140// In-memory key-value store shared across all windows (mirrors Tauri's put_item/get_all_items)
@@ -126,17 +145,17 @@ ipcMain.handle('toggle-dev-tools', (event) => {
126145// Get path to phnode binary
127146ipcMain . handle ( 'get-phnode-path' , ( event ) => {
128147 assertTrusted ( event ) ;
129- const phNodePath = path . resolve ( __dirname , 'bin' , 'phnode' ) ;
148+ const phNodePath = getPhNodePath ( ) ;
130149 if ( ! fs . existsSync ( phNodePath ) ) {
131150 throw new Error ( `phnode binary does not exist: ${ phNodePath } ` ) ;
132151 }
133152 return phNodePath ;
134153} ) ;
135154
136- // Get path to src-node (for development)
155+ // Get path to src-node
137156ipcMain . handle ( 'get-src-node-path' , ( event ) => {
138157 assertTrusted ( event ) ;
139- const srcNodePath = path . resolve ( __dirname , '..' , '..' , 'phoenix' , 'src-node' ) ;
158+ const srcNodePath = getSrcNodePath ( ) ;
140159 if ( ! fs . existsSync ( srcNodePath ) ) {
141160 throw new Error ( `src-node path does not exist: ${ srcNodePath } ` ) ;
142161 }
0 commit comments