mirror of
https://github.com/msojocs/wechat-web-devtools-linux.git
synced 2025-07-07 00:02:14 +08:00
44 lines
1.3 KiB
JavaScript
Executable File
44 lines
1.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
const path = require("path");
|
|
const fs = require("fs");
|
|
const os = require("os");
|
|
const { spawn } = require("child_process");
|
|
const { info } = require("console");
|
|
|
|
for (let size of ["64", "128", "256", "512"]) {
|
|
let iconPath =
|
|
os.homedir() +
|
|
`/.local/share/icons/hicolor/${size}x${size}/wechat-devtools.png`;
|
|
try {
|
|
fs.mkdirSync(path.dirname(iconPath));
|
|
} catch (error) {}
|
|
info(`Writing icon file ${iconPath}`);
|
|
fs.copyFileSync(
|
|
path.resolve(__dirname, "../res/icons", `wechat-devtools${size}.png`),
|
|
iconPath
|
|
);
|
|
}
|
|
|
|
let svgPath =
|
|
os.homedir() + "/.local/share/icons/hicolor/scalable/wechat-devtools.svg";
|
|
try {
|
|
fs.mkdirSync(path.dirname(svgPath));
|
|
} catch (error) {}
|
|
info(`Writing icon file ${svgPath}`);
|
|
fs.copyFileSync(
|
|
path.resolve(__dirname, "../res/icons/wechat-devtools.svg"),
|
|
svgPath
|
|
);
|
|
|
|
let desktopCode = fs
|
|
.readFileSync(path.resolve(__dirname, "../res/template.desktop"), "utf8")
|
|
.replace(new RegExp("dir", "g"), path.resolve(__dirname, ".."));
|
|
|
|
desktopPath =
|
|
os.homedir() + "/.local/share/applications/wechat-devtools.desktop";
|
|
try {
|
|
fs.mkdirSync(path.dirname(desktopPath));
|
|
} catch (error) {}
|
|
info(`Writing desktop file ${desktopPath}`);
|
|
fs.writeFileSync(desktopPath, desktopCode);
|