"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DeleteTransaction = void 0; const path = require("node:path"); const fs = require("fs"); class DeleteTransaction { static deleteScriptAccount(projectDir, componentName) { const filename = path.join(projectDir, "script-accounts", componentName + ".json"); fs.unlinkSync(filename); console.log("Delete ", filename); } static deleteGamesystem(projectDir, componentName) { const gamesystemDir = path.join(projectDir, "gamesystems"); const gamesystemFile = this.findGamesystemPath(gamesystemDir, componentName); try { if (gamesystemFile != undefined) { console.log("Delete Gamesystem under File: ", gamesystemFile); if (fs.lstatSync(gamesystemFile).isDirectory()) { fs.rmSync(gamesystemFile, { recursive: true, force: true }); } else { fs.unlinkSync(gamesystemFile); } } } catch (e) { console.log(e); } } static findGamesystemPath(gamesystemRootDir, searchedFilename) { const directoriesToProcess = []; directoriesToProcess.push(gamesystemRootDir); while (directoriesToProcess.length > 0) { const currentDirectory = directoriesToProcess.shift(); const filesInDirectory = fs.readdirSync(currentDirectory); for (let i = 0; i < filesInDirectory.length; i++) { const currentFile = path.join(currentDirectory, filesInDirectory[i]); if (fs.lstatSync(currentFile).isDirectory()) { directoriesToProcess.push(currentFile); } if (path.parse(path.basename(currentFile)).name === searchedFilename) { return currentFile; } } } return undefined; } } exports.DeleteTransaction = DeleteTransaction; //# sourceMappingURL=DeleteModel.js.map