From d6eb54d21ce213d0c49288c1d6c85bd2b40b0b64 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 1 Dec 2021 01:19:49 +0100 Subject: [PATCH] fix(absolute pathing): add functions for easily getting absolute paths --- ts/smartfile.classes.smartfile.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ts/smartfile.classes.smartfile.ts b/ts/smartfile.classes.smartfile.ts index ed90e53..7bb51f1 100644 --- a/ts/smartfile.classes.smartfile.ts +++ b/ts/smartfile.classes.smartfile.ts @@ -69,7 +69,7 @@ export class Smartfile extends plugins.smartjson.Smartjson { // INSTANCE // ======== /** - * the full path of the file on disk + * the relative path of the file */ @plugins.smartjson.foldDec() public path: string; @@ -116,6 +116,14 @@ export class Smartfile extends plugins.smartjson.Smartjson { this.base = optionsArg.base; } + public getAbsolutePath () { + return plugins.path.join(this.base, this.path); + } + + public getAbsoluteParsedPath() { + return plugins.path.parse(this.getAbsolutePath()); + } + /** * set contents from string * @param contentString