()
| 92 | } |
| 93 | |
| 94 | function getCurrentAppPath(): string { |
| 95 | if (!global.__dirname) { |
| 96 | global.__dirname = typeof __dirname !== 'undefined' ? __dirname : import.meta.dirname; |
| 97 | } |
| 98 | const currentDir = global.__dirname; |
| 99 | const tnsModulesIndex = currentDir.indexOf('/tns_modules'); |
| 100 | |
| 101 | // Module not hosted in ~/tns_modules when bundled. Use current dir. |
| 102 | let appPath = currentDir; |
| 103 | if (tnsModulesIndex !== -1) { |
| 104 | // Strip part after tns_modules to obtain app root |
| 105 | appPath = currentDir.substring(0, tnsModulesIndex); |
| 106 | } |
| 107 | |
| 108 | return appPath; |
| 109 | } |
| 110 | |
| 111 | function joinPaths(...paths: string[]): string { |
| 112 | if (!paths || paths.length === 0) { |
no test coverage detected