rokojori-godot/rokojori-cpp-generator/builds/copy-cpp-source.js

43 lines
1.8 KiB
JavaScript

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const RJLog_1 = require("./library/RJLog");
const fs = require("node:fs/promises");
let from = __dirname + "/../../rokojori-action-library";
let to = __dirname + "/../../godot/modules/rokojori_action_library";
function main() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log("Copying C++ source");
yield deleteOldDirectory();
yield copyToModules();
// await runBuild();
RJLog_1.RJLog.log("Copying C++ source");
});
}
function deleteOldDirectory() {
return __awaiter(this, void 0, void 0, function* () {
let stats = yield fs.stat(to);
if (stats) {
RJLog_1.RJLog.log(`deleting previous directory: "${to}"`);
yield fs.rm(to, { recursive: true });
}
return Promise.resolve();
});
}
function copyToModules() {
return __awaiter(this, void 0, void 0, function* () {
RJLog_1.RJLog.log("copying:", `"${from}" >> "${to}"`);
yield fs.cp(from, to, { recursive: true });
return Promise.resolve();
});
}
main();
//# sourceMappingURL=copy-cpp-source.js.map