mirror of
https://github.com/yuaotian/go-cursor-help.git
synced 2025-06-08 12:32:06 +08:00
Bugfix: 修复删除 cursor-updater 目录失败的问题
问题描述: 在 Windows 系统上,如果用户已经执行过脚本,cursor-updater文件已存在,再次执行脚本删除cursor-updater目录会报错
This commit is contained in:
parent
f752fa8322
commit
27b2f28765
@ -399,17 +399,25 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# 删除现有目录
|
# 检查cursor-updater是否存在
|
||||||
if (Test-Path $updaterPath) {
|
if (Test-Path $updaterPath) {
|
||||||
try {
|
# 如果是文件,说明已经创建了阻止更新
|
||||||
Remove-Item -Path $updaterPath -Force -Recurse -ErrorAction Stop
|
if ((Get-Item $updaterPath) -is [System.IO.FileInfo]) {
|
||||||
Write-Host "$GREEN[信息]$NC 成功删除 cursor-updater 目录"
|
Write-Host "$GREEN[信息]$NC 已创建阻止更新文件,无需再次阻止"
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host "$RED[错误]$NC 删除 cursor-updater 目录失败"
|
|
||||||
Show-ManualGuide
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
# 如果是目录,尝试删除
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
Remove-Item -Path $updaterPath -Force -Recurse -ErrorAction Stop
|
||||||
|
Write-Host "$GREEN[信息]$NC 成功删除 cursor-updater 目录"
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "$RED[错误]$NC 删除 cursor-updater 目录失败"
|
||||||
|
Show-ManualGuide
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# 创建阻止文件
|
# 创建阻止文件
|
||||||
|
Loading…
x
Reference in New Issue
Block a user