isFileOrResourcePath and RESOURCE_PREFIX moved in utils

This commit is contained in:
Vladimir Enchev
2015-05-18 17:15:04 +03:00
parent cf30d73172
commit 6b71ea07b4
4 changed files with 25 additions and 13 deletions

View File

@@ -1,5 +1,7 @@
import types = require("utils/types");
export var RESOURCE_PREFIX = "res://";
export function copyFrom(source: any, target: any) {
if (types.isDefined(source) && types.isDefined(target)) {
var i: number;
@@ -50,4 +52,14 @@ export module layout {
export function getMeasureSpecSize(spec: number): number {
return (spec & ~MODE_MASK);
}
}
export function isFileOrResourcePath(path: string): boolean {
if (!types.isString(path)) {
return false;
}
return path.indexOf("~/") === 0 || // relative to AppRoot
path.indexOf("/") === 0 || // absolute path
path.indexOf(RESOURCE_PREFIX) === 0; // resource
}