(relativePath)
| 14 | |
| 15 | // Function to get proper resource path (works in both development and production) |
| 16 | function getResourcePath(relativePath) { |
| 17 | // Handle core paths specially |
| 18 | if (relativePath.startsWith('core')) { |
| 19 | // Use the global core directory path |
| 20 | const corePath = global.__coredir || path.join(__dirname, 'core'); |
| 21 | |
| 22 | // If the path is just 'core', return the directory |
| 23 | if (relativePath === 'core') { |
| 24 | return corePath; |
| 25 | } |
| 26 | |
| 27 | // If the path is more specific (e.g., 'core/xray.exe'), append to core path |
| 28 | // Handle both 'core/' and 'core\' separators |
| 29 | let cleanPath = relativePath.replace('core/', '').replace('core\\', ''); |
| 30 | |
| 31 | // Special handling for xray files - they're in the xray subdirectory |
| 32 | if (cleanPath === 'xray.exe') { |
| 33 | return path.join(corePath, 'xray', cleanPath); |
| 34 | } |
| 35 | |
| 36 | return path.join(corePath, cleanPath); |
| 37 | } else { |
| 38 | // For other resources, use the normal path |
| 39 | return app.isPackaged |
| 40 | ? path.join(process.resourcesPath, relativePath) |
| 41 | : path.join(__dirname, relativePath); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | // Use the global asset path for any file references |
| 46 | function getAssetPath(relativePath) { |
no outgoing calls
no test coverage detected