fix(absolute pathing): add functions for easily getting absolute paths

This commit is contained in:
Philipp Kunz 2021-12-01 01:19:49 +01:00
parent 6646f173c6
commit d6eb54d21c

View File

@ -69,7 +69,7 @@ export class Smartfile extends plugins.smartjson.Smartjson {
// INSTANCE // INSTANCE
// ======== // ========
/** /**
* the full path of the file on disk * the relative path of the file
*/ */
@plugins.smartjson.foldDec() @plugins.smartjson.foldDec()
public path: string; public path: string;
@ -116,6 +116,14 @@ export class Smartfile extends plugins.smartjson.Smartjson {
this.base = optionsArg.base; 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 * set contents from string
* @param contentString * @param contentString