decova-gotcha
Version:
It's my personal trial for automating daunting tasks
111 lines • 5.89 kB
JavaScript
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PathMan = exports.CommonDirName = void 0;
const decova_dotnet_1 = require("decova-dotnet");
const decova_filesystem_1 = require("decova-filesystem");
const tsyringe_1 = require("tsyringe");
var CommonDirName;
(function (CommonDirName) {
CommonDirName["vscode"] = ".vscode";
CommonDirName["gotcha_main_dir"] = "decova-gotcha-data";
CommonDirName["text_snippets"] = "text-snippets";
})(CommonDirName = exports.CommonDirName || (exports.CommonDirName = {}));
var CommonFileName;
(function (CommonFileName) {
CommonFileName["decovaSettings"] = "decova-settings.json";
CommonFileName["decovaSnippets"] = "decova.code-snippets";
CommonFileName["launch"] = "launch.json";
CommonFileName["tasksJson"] = "tasks.json";
CommonFileName["settings"] = "settings.json";
CommonFileName["packgeJson"] = "package.json";
CommonFileName["WalkthroughsSheet"] = "walkthroughs_sheet.json";
CommonFileName["WalkthroughsSchema"] = "walkthroughs_schema.json";
})(CommonFileName || (CommonFileName = {}));
let PathMan = class PathMan {
get UserProfileDir() {
if (this._UserProfileDir)
return this._UserProfileDir;
if (!process.env.USERPROFILE) {
throw new decova_dotnet_1.Exception_InvalidProgramState("process.env.USERPROFILE", "process.env.USERPROFILE is empty or undefined");
}
this._UserProfileDir = new decova_filesystem_1.DirectoryInfo(process.env.USERPROFILE);
return this._UserProfileDir;
}
get GotchaMainDir() {
if (this._GotchaMainDir)
return this._GotchaMainDir;
this._GotchaMainDir = new decova_filesystem_1.DirectoryInfo(`${this.UserProfileDir.FullName}\\${CommonDirName.gotcha_main_dir}`);
this._GotchaMainDir.Ensure();
return this._GotchaMainDir;
}
get GotchaLocalRepo_Vscode_Dir() {
const path = decova_filesystem_1.Path.Join(this.GotchaMainDir.FullName, CommonDirName.vscode);
return new decova_filesystem_1.DirectoryInfo(path);
}
get GotchaLocalRepo_WalkthroughsSheet() {
const path = decova_filesystem_1.Path.Join(this.GotchaMainDir.FullName, CommonFileName.WalkthroughsSheet);
return new decova_filesystem_1.FileInfo(path);
}
get GotchaLocalRepo_DecovaSettingsFile() {
const path = decova_filesystem_1.Path.Join(this.GotchaLocalRepo_Vscode_Dir.FullName, CommonFileName.decovaSettings);
return new decova_filesystem_1.FileInfo(path);
}
get GotchaLocalRepo_DecovaSnippets() {
const path = decova_filesystem_1.Path.Join(this.GotchaLocalRepo_Vscode_Dir.FullName, CommonFileName.decovaSnippets);
return new decova_filesystem_1.FileInfo(path);
}
get GotchaLocalRepo_LaunchFile() {
const path = decova_filesystem_1.Path.Join(this.GotchaLocalRepo_Vscode_Dir.FullName, CommonFileName.launch);
return new decova_filesystem_1.FileInfo(path);
}
get GotchaLocalRepo_SettingsFile() {
const path = decova_filesystem_1.Path.Join(this.GotchaLocalRepo_Vscode_Dir.FullName, CommonFileName.settings);
return new decova_filesystem_1.FileInfo(path);
}
get CurrentWorkspace() {
return decova_filesystem_1.DirectoryInfo.Current;
}
get CurrentWorkspace_VsCodeDir() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace.FullName, CommonDirName.vscode);
return new decova_filesystem_1.DirectoryInfo(path);
}
get CurrentWorkspace_DecovaSettings() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace_VsCodeDir.FullName, CommonFileName.decovaSettings);
return new decova_filesystem_1.FileInfo(path);
}
get CurrentWorkspace_Settings() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace_VsCodeDir.FullName, CommonFileName.settings);
return new decova_filesystem_1.FileInfo(path);
}
get CurrentWorkspace_Tasks() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace_VsCodeDir.FullName, CommonFileName.tasksJson);
return new decova_filesystem_1.FileInfo(path);
}
get CurrentWorkspace_DecovaSnippets() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace_VsCodeDir.FullName, CommonFileName.decovaSnippets);
return new decova_filesystem_1.FileInfo(path);
}
get CurrentWorkspace_Lanuch() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace_VsCodeDir.FullName, CommonFileName.launch);
return new decova_filesystem_1.FileInfo(path);
}
get GotchaLocalRepo_TextSnippets_Dir() {
const path = decova_filesystem_1.Path.Join(this.GotchaLocalRepo_Vscode_Dir.FullName, CommonDirName.text_snippets);
return new decova_filesystem_1.DirectoryInfo(path);
}
get CurrentWorkspace_PackageJson() {
const path = decova_filesystem_1.Path.Join(this.CurrentWorkspace.FullName, CommonFileName.packgeJson);
return new decova_filesystem_1.FileInfo(path);
}
};
PathMan = __decorate([
(0, tsyringe_1.singleton)()
], PathMan);
exports.PathMan = PathMan;
//# sourceMappingURL=PathMan.js.map