MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getCurrentAppPath

Function getCurrentAppPath

packages/core/utils/debug-source.ts:5–23  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3// console.log('__dirname:', global.__dirname);
4
5function 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
25let applicationRootPath: string;
26function ensureAppRootPath() {

Callers 1

ensureAppRootPathFunction · 0.70

Calls 2

getNativeAppFunction · 0.90
indexOfMethod · 0.80

Tested by

no test coverage detected