Merge pull request #1407 from NativeScript/atanasovg/snapshot-refactorings

Atanasovg/snapshot refactorings
This commit is contained in:
Georgi Atanasov
2016-01-25 10:29:24 +02:00
38 changed files with 1107 additions and 809 deletions

View File

@@ -3,8 +3,13 @@ import { knownFolders } from "file-system"
export var debug = true;
// TODO: Get this from the runtimes...
var applicationRootPath = knownFolders.currentApp().path;
applicationRootPath = applicationRootPath.substr(0, applicationRootPath.length - "app/".length);
var applicationRootPath: string;
function ensureAppRootPath() {
if (!applicationRootPath) {
applicationRootPath = knownFolders.currentApp().path;
applicationRootPath = applicationRootPath.substr(0, applicationRootPath.length - "app/".length);
}
}
export class Source {
private _uri: string;
@@ -14,7 +19,9 @@ export class Source {
private static _source: symbol = Symbol("source");
private static _appRoot: string;
constructor(uri: string, line: number, column: number) {
constructor(uri: string, line: number, column: number) {
ensureAppRootPath();
if (uri.length > applicationRootPath.length && uri.substr(0, applicationRootPath.length) === applicationRootPath) {
this._uri = "file://" + uri.substr(applicationRootPath.length);
} else {