diff --git a/lib/manager/FSPath.d.ts b/lib/manager/FSPath.d.ts index 1f7c427f..a0bf21cb 100644 --- a/lib/manager/FSPath.d.ts +++ b/lib/manager/FSPath.d.ts @@ -8,6 +8,7 @@ export declare class FSPath { getParent(): FSPath; hasParent(): boolean; removeRoot(): void; + getChildPath(childName: string): FSPath; clone(): FSPath; toString(): string; } diff --git a/lib/manager/FSPath.js b/lib/manager/FSPath.js index 7de8703e..3568acbe 100644 --- a/lib/manager/FSPath.js +++ b/lib/manager/FSPath.js @@ -30,6 +30,11 @@ var FSPath = (function () { FSPath.prototype.removeRoot = function () { this.paths.splice(0, 1); }; + FSPath.prototype.getChildPath = function (childName) { + var path = this.clone(); + path.paths.push(childName); + return path; + }; FSPath.prototype.clone = function () { return new FSPath(this); }; diff --git a/src/manager/FSPath.ts b/src/manager/FSPath.ts index 960f67ab..7eba7777 100644 --- a/src/manager/FSPath.ts +++ b/src/manager/FSPath.ts @@ -48,6 +48,13 @@ export class FSPath this.paths.splice(0, 1); } + getChildPath(childName : string) : FSPath + { + const path = this.clone(); + path.paths.push(childName); + return path; + } + clone() : FSPath { return new FSPath(this);