| import { join } from 'path' |
|
|
| |
| |
| |
| |
| |
| |
| export function normalizeFilePath(path: string): string { |
| return path.replace(/^(file:[\\/]+)([^:\s]+)$/, '$2') |
| } |
|
|
| export async function appResourcePath(): Promise<string> { |
| let electron: any = undefined |
|
|
| try { |
| const moduleName = 'electron' |
| electron = await import(moduleName) |
| } catch (err) { |
| console.error('Electron is not available') |
| } |
|
|
| |
| if (electron && electron.protocol) { |
| let appPath = join(electron.app.getAppPath(), '..', 'app.asar.unpacked') |
|
|
| if (!electron.app.isPackaged) { |
| |
| appPath = join(electron.app.getAppPath()) |
| } |
| return appPath |
| } |
| |
| return join(global.core.appPath(), '../../..') |
| } |
|
|