summary refs log tree commit diff
path: root/scripts/patches/applyPatches.js
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-26 04:14:54 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:48:14 +0200
commit8ba8828fae6a80c3b30b6bea513be4a9620c8705 (patch)
treee627fb33f4059ab55109d7efbead25d1570c8ee7 /scripts/patches/applyPatches.js
parentPrettier (diff)
downloadserver-8ba8828fae6a80c3b30b6bea513be4a9620c8705.tar.xz
Basic client patching system
Diffstat (limited to 'scripts/patches/applyPatches.js')
-rw-r--r--scripts/patches/applyPatches.js24
1 files changed, 24 insertions, 0 deletions
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