From ab1a09591adfb9534485dbe3943f09d33076791e Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 26 Aug 2022 04:14:54 +0200 Subject: Basic client patching system --- scripts/patches/applyPatches.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 scripts/patches/applyPatches.js (limited to 'scripts/patches/applyPatches.js') diff --git a/scripts/patches/applyPatches.js b/scripts/patches/applyPatches.js new file mode 100644 index 00000000..66524ede --- /dev/null +++ b/scripts/patches/applyPatches.js @@ -0,0 +1,24 @@ +const { execSync } = require("child_process"); +const path = require("path"); +const fs = require("fs"); +const { argv, stdout, exit } = require("process"); +const { execIn, parts, getDirs, walk, sanitizeVarName } = require("../utils"); + +//apply patches +const patchDir = path.join(__dirname, "..", "..", "assets", "testclient_patches"); +const targetDir = path.join(__dirname, "..", "..", "assets", "cache"); +const files = fs.readdirSync(patchDir); +files.forEach((file) => { + const filePath = path.join(patchDir, file); + const stats = fs.statSync(filePath); + if (stats.isFile()) { + const ext = path.extname(file); + if (ext === ".patch") { + execSync(`git apply ${filePath}`, { + cwd: targetDir, + maxBuffer: 1024 * 1024 * 10, + }); + console.log(`Applied patch ${file} to ${newFilePath}`); + } + } +}); \ No newline at end of file -- cgit 1.5.1