UNPKG

@microsoft/windows-admin-center-sdk

Version:

Microsoft - Windows Admin Center Shell

49 lines (47 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RemoveUpgrader = void 0; const fs_extra_1 = require("fs-extra"); const logger_1 = require("../utils/logger"); const file_writer_1 = require("../utils/file-writer"); class RemoveUpgrader { filePath; fileWriter; removes; messages = { notFound: '' }; /** * the constructor. * @param filePath the file path. * @param removes the removes. * @param fileName the file name. */ constructor(filePath, removes, fileName) { this.filePath = filePath; this.messages.notFound = `${fileName} not found at ${this.filePath}.`; this.removes = removes; } /** * the run function to resolve the errors. */ async run() { try { const exists = await (0, fs_extra_1.pathExists)(this.filePath); if (exists) { this.fileWriter = new file_writer_1.FileWriter(this.filePath); this.fileWriter .removeContent(this.removes) .writeFile(); } else { logger_1.Logger.log(this.messages.notFound); } } catch (error) { logger_1.Logger.error(error); } } } exports.RemoveUpgrader = RemoveUpgrader; //# sourceMappingURL=remove-upgrader.js.map