"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
const GitHubFolder_1 = require("./GitHubFolder");
const StorageBase_1 = require("../storage/StorageBase");
class GitHubStorage extends StorageBase_1.default {
    constructor(manager, repoName, ownerName, branch, subPath = "") {
        super();
        this.manager = manager;
        this.repoName = repoName;
        this.branch = branch;
        this.ownerName = ownerName;
        if (ownerName !== "microsoft" && ownerName !== "mojang") {
            throw new Error("Unsupported GitHub action.");
        }
        this.subPath = subPath;
        this.rootFolder = new GitHubFolder_1.default(this, null, subPath, "");
    }
    joinPath(pathA, pathB) {
        let fullPath = pathA;
        if (!fullPath.endsWith(GitHubStorage.slashFolderDelimiter)) {
            fullPath += GitHubStorage.slashFolderDelimiter;
        }
        fullPath += pathB;
        return fullPath;
    }
    static getParentFolderPath(path) {
        const lastDelim = path.lastIndexOf(this.slashFolderDelimiter);
        if (lastDelim < 0) {
            return path;
        }
        return path.substring(0, lastDelim);
    }
}
exports.default = GitHubStorage;

//# sourceMappingURL=../maps/github/GitHubStorage.js.map
