currentApp old code restored

This commit is contained in:
Vladimir Enchev
2016-02-17 14:41:12 +02:00
parent e9d9d8c729
commit 46b7fc6d4a

View File

@ -1,5 +1,4 @@
import file_access_module = require("file-system/file-system-access");
import * as utilsModule from "utils/utils";
// The FileSystemAccess implementation, used through all the APIs.
var fileAccess;
@ -484,9 +483,17 @@ export module knownFolders {
export var currentApp = function (): Folder {
if (!_app) {
var logicalRoot = getFileAccess().getLogicalRootPath();
const currentDir = __dirname;
const tnsModulesIndex = currentDir.indexOf("/tns_modules");
// Module not hosted in ~/tns_modules when bundled. Use current dir.
let appPath = currentDir;
if (tnsModulesIndex !== -1) {
// Strip part after tns_modules to obtain app root
appPath = currentDir.substring(0, tnsModulesIndex);
}
_app = new Folder();
_app[pathProperty] = logicalRoot + "/app";
_app[pathProperty] = appPath;
_app[isKnownProperty] = true;
}