()
| 3 | // console.log('__dirname:', global.__dirname); |
| 4 | |
| 5 | function getCurrentAppPath(): string { |
| 6 | if (__APPLE__) { |
| 7 | const currentDir = global.__dirname; |
| 8 | const tnsModulesIndex = currentDir.indexOf('/tns_modules'); |
| 9 | |
| 10 | // Module not hosted in ~/tns_modules when bundled. Use current dir. |
| 11 | let appPath = currentDir; |
| 12 | if (tnsModulesIndex !== -1) { |
| 13 | // Strip part after tns_modules to obtain app root |
| 14 | appPath = currentDir.substring(0, tnsModulesIndex); |
| 15 | } |
| 16 | |
| 17 | return appPath; |
| 18 | } else { |
| 19 | const dir = getNativeApp<android.app.Application>().getApplicationContext().getFilesDir(); |
| 20 | |
| 21 | return `${dir.getCanonicalPath()}/app`; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | let applicationRootPath: string; |
| 26 | function ensureAppRootPath() { |
no test coverage detected