rokojori-godot/rokojori-cpp-generator/source/copy-cpp-source.ts

43 lines
844 B
TypeScript

import { Files } from "./library/Files";
import { RJLog } from "./library/RJLog";
const fs = require( "node:fs/promises" );
let from = __dirname + "/../../rokojori-action-library";
let to = __dirname + "/../../godot/modules/rokojori_action_library"
async function main()
{
RJLog.log( "Copying C++ source" );
await deleteOldDirectory();
await copyToModules();
// await runBuild();
RJLog.log( "Copying C++ source" );
}
async function deleteOldDirectory()
{
let stats = await fs.stat( to );
if ( stats )
{
RJLog.log( `deleting previous directory: "${to}"` );
await fs.rm( to, { recursive: true } );
}
return Promise.resolve();
}
async function copyToModules()
{
RJLog.log( "copying:", `"${from}" >> "${to}"` );
await fs.cp( from, to, { recursive : true } );
return Promise.resolve();
}
main();