From 09be3ac6ebe337ffb81232d64f3b175a5627cb74 Mon Sep 17 00:00:00 2001 From: OxO Date: Sun, 29 Dec 2024 10:50:58 +0800 Subject: [PATCH] clash-verge-rev: Fix config dir (#14543) * clash-verge-rev: Fix config dir * clash-verge-rev: improve directory handling during installation --- bucket/clash-verge-rev.json | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bucket/clash-verge-rev.json b/bucket/clash-verge-rev.json index 06b7da88e0d7d2..0b03129aedcd47 100644 --- a/bucket/clash-verge-rev.json +++ b/bucket/clash-verge-rev.json @@ -17,7 +17,17 @@ "installer": { "script": [ "ensure \"$persist_dir\" | Out-Null", - "New-Item \"$env:USERPROFILE\\.config\\clash-verge\" -ItemType Junction -Target \"$persist_dir\" | Out-Null" + "$targetPath = \"$env:APPDATA\\io.github.clash-verge-rev.clash-verge-rev\"", + "$linkType = (Get-Item -Path $targetPath -ErrorAction SilentlyContinue).LinkType", + "if (Test-Path $targetPath) {", + " if ($linkType -eq 'Junction') {", + " Remove-Item -Path $targetPath -Force", + " } else {", + " Get-ChildItem -Path $targetPath -Force | Move-Item -Destination $persist_dir -Force", + " Remove-Item -Path $targetPath -Force -Recurse", + " }", + "}", + "New-Item \"$env:APPDATA\\io.github.clash-verge-rev.clash-verge-rev\" -ItemType Junction -Target \"$persist_dir\" | Out-Null" ] }, "pre_uninstall": [ @@ -25,7 +35,7 @@ "Start-Process \"$dir\\resources\\uninstall-service.exe\" -Wait -Verb 'RunAs' -WindowStyle 'Hidden'; Start-Sleep -Seconds 3" ], "uninstaller": { - "script": "Remove-Item \"$env:USERPROFILE\\.config\\clash-verge\" -Recurse -Force -ErrorAction 'SilentlyContinue'" + "script": "Remove-Item \"$env:APPDATA\\io.github.clash-verge-rev.clash-verge-rev\" -Recurse -Force -ErrorAction 'SilentlyContinue'" }, "shortcuts": [ [