UNPKG

@minecraft/creator-tools

Version:

Minecraft Creator Tools command line and libraries.

38 lines (37 loc) 1.2 kB
"use strict"; // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Folder_1 = __importDefault(require("./Folder")); const StorageBase_1 = __importDefault(require("./StorageBase")); class Storage extends StorageBase_1.default { rootFolder; static folderDelimiter = "/"; constructor() { super(); this.rootFolder = new Folder_1.default(this, null, "", "root"); } joinPath(pathA, pathB) { let fullPath = pathA; if (!fullPath.endsWith(Storage.folderDelimiter)) { fullPath += Storage.folderDelimiter; } fullPath += pathB; return fullPath; } static getParentFolderPath(path) { const lastDelim = path.lastIndexOf(this.folderDelimiter); if (lastDelim < 0) { return path; } return path.substring(0, lastDelim); } async getAvailable() { this.available = true; return this.available; } } exports.default = Storage;