@minecraft/creator-tools
Version:
Minecraft Creator Tools command line and libraries.
35 lines (33 loc) • 1.23 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const FileSystemFolder_1 = require("./FileSystemFolder");
const StorageBase_1 = require("./StorageBase");
class FileSystemStorage extends StorageBase_1.default {
get folderDelimiter() {
return FileSystemStorage.fileSystemFolderDelimiter;
}
constructor(handle, name) {
super();
this.rootFolder = new FileSystemFolder_1.default(this, null, "", name ? name : "root", handle);
}
joinPath(pathA, pathB) {
let fullPath = pathA;
if (!fullPath.endsWith(FileSystemStorage.fileSystemFolderDelimiter)) {
fullPath += FileSystemStorage.fileSystemFolderDelimiter;
}
fullPath += pathB;
return fullPath;
}
static getParentFolderPath(path) {
const lastDelim = path.lastIndexOf(this.fileSystemFolderDelimiter);
if (lastDelim < 0) {
return path;
}
return path.substring(0, lastDelim);
}
}
exports.default = FileSystemStorage;
FileSystemStorage.fileSystemFolderDelimiter = "/";
//# sourceMappingURL=../maps/storage/FileSystemStorage.js.map