UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

45 lines 1.45 kB
import path from "upath"; import { FileDescriptor } from "../../../PackageSystem/FileDescriptor.js"; const { basename, isAbsolute, normalize, sep } = path; /** * Provides a description of a directory which contains images. */ export class ImageDirectoryDescriptor extends FileDescriptor { /** * Initializes a new instance of the {@link ImageDirectoryDescriptor `ImageDirectoryDescriptor`} class. * * @param options * The options of the image-directory descriptor. */ constructor(options) { var _a; super({ Source: options.Source, FileName: (_a = options.FileName) !== null && _a !== void 0 ? _a : "images.tar" }); if ((options.DestinationRoot !== null) && (options.DestinationRoot !== undefined)) { this.destinationRoot = options.DestinationRoot; } else if (isAbsolute(options.Source) || (normalize(options.Source).split(sep)[0] === "..")) { this.DestinationRoot = basename(options.Source); } else { this.destinationRoot = options.Source; } } /** * Gets or sets the folder to upload the images to. */ get DestinationRoot() { return this.destinationRoot; } /** * @inheritdoc */ set DestinationRoot(value) { this.destinationRoot = value; } } //# sourceMappingURL=ImageDirectoryDescriptor.js.map