UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

49 lines 1.37 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Path = require("path"); const UPath = require("upath"); const util_1 = require("util"); /** * Provides a description of a file. */ class FileDescriptor { /** * Initializes a new instance of the `FileDescriptor` class. */ constructor(options) { this.Source = Path.resolve(options.Source); if (util_1.isNullOrUndefined(options.FileName)) { let fileName = Path.normalize(options.Source); if (Path.isAbsolute(fileName) || (UPath.normalize(fileName).split(UPath.sep)[0] === "..")) { this.FileName = Path.basename(fileName); } else { this.FileName = fileName; } } else { this.FileName = options.FileName; } } /** * Gets or sets the path to load the file from. */ get Source() { return this.source; } set Source(value) { this.source = value; } /** * Gets ort sets the filename to save the file to. */ get FileName() { return this.fileName; } set FileName(value) { this.fileName = value; } } exports.FileDescriptor = FileDescriptor; //# sourceMappingURL=FileDescriptor.js.map