refactor: Change Portable Config Path (#66)

This commit is contained in:
Pylogmon 2023-12-05 12:52:26 +08:00 committed by GitHub
parent 7534f8fc37
commit d4040b61c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,12 +16,18 @@ const ARCH_MAP = {
async function resolvePortable() {
if (process.platform !== "win32") return;
const releaseDir = `./src-tauri/target/${target}/release`;
const releaseDir = target
? `./src-tauri/target/${target}/release`
: `./src-tauri/target/release`;
const configDir = path.join(releaseDir, ".config");
if (!(await fs.pathExists(releaseDir))) {
throw new Error("could not found the release dir");
}
await fs.mkdir(configDir);
await fs.createFile(path.join(configDir, "PORTABLE"));
const zip = new AdmZip();
zip.addLocalFile(path.join(releaseDir, "Clash Verge.exe"));
@ -29,6 +35,7 @@ async function resolvePortable() {
zip.addLocalFile(path.join(releaseDir, "clash-meta.exe"));
zip.addLocalFile(path.join(releaseDir, "clash-meta-alpha.exe"));
zip.addLocalFolder(path.join(releaseDir, "resources"), "resources");
zip.addLocalFolder(configDir, ".config");
const require = createRequire(import.meta.url);
const packageJson = require("../package.json");