wechat-web-devtools-linux/tools/fix-selection-copy-node
2022-02-27 20:15:14 +08:00

24 lines
695 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
const path = require("path");
const os = require("os");
const fs = require("fs");
const { execSync } = require("child_process");
console.info("Patching editor selection copy configs");
let configPath = os.homedir() + "/.config/wechat_devtools/Default/Editor/User/settings.json";
let config = undefined;
if (fs.existsSync(configPath)) {
// console.info(configPath)
config = JSON.parse(fs.readFileSync(configPath, "utf8"));
} else {
config = {};
}
config["editor.selectionClipboard"] = false;
// nodejs只支持一级一级目录创建效率低
execSync(`mkdir -p ${path.dirname(configPath)}`)
fs.writeFileSync(configPath, JSON.stringify(config, null, 4));