summary refs log tree commit diff
path: root/scripts/patches/applyPatches.js
blob: 66524ede6ccc91b7685b8b557a4f7043677af3f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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}`);
        }
    }
});