mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 Prompt and block installation when a workspace exists in the Windows desktop installation path https://github.com/siyuan-note/siyuan/issues/14864
This commit is contained in:
parent
ae4adfeba4
commit
4a2041e4d6
1 changed files with 75 additions and 0 deletions
|
|
@ -12,6 +12,15 @@ Caption "${PRODUCT_NAME} ${VERSION}"
|
||||||
nsExec::Exec 'TASKKILL /F /IM "SiYuan-Kernel.exe"'
|
nsExec::Exec 'TASKKILL /F /IM "SiYuan-Kernel.exe"'
|
||||||
!macroend
|
!macroend
|
||||||
|
|
||||||
|
!macro customInit
|
||||||
|
${FindIt} "$INSTDIR" "data" $R0
|
||||||
|
${If} -1 != $R0
|
||||||
|
MessageBox MB_ICONSTOP "检测到安装路径下包含了工作空间数据 $R0,请将工作空间文件夹移到其他位置后再试。$\n$\n\
|
||||||
|
The workspace data $R0 was detected in the installation path, please move the workspace folder to another location and try again.$\n"
|
||||||
|
Quit
|
||||||
|
${EndIf}
|
||||||
|
!macroend
|
||||||
|
|
||||||
!macro customUnInit
|
!macro customUnInit
|
||||||
${un.FindIt} "$INSTDIR" "data" $R0
|
${un.FindIt} "$INSTDIR" "data" $R0
|
||||||
${If} -1 != $R0
|
${If} -1 != $R0
|
||||||
|
|
@ -98,6 +107,72 @@ Push $R6
|
||||||
StrCmp $R3 0 0 nextDir
|
StrCmp $R3 0 0 nextDir
|
||||||
StrCpy $R0 $R6
|
StrCpy $R0 $R6
|
||||||
|
|
||||||
|
Pop $R6
|
||||||
|
Pop $R5
|
||||||
|
Pop $R4
|
||||||
|
Pop $R3
|
||||||
|
Pop $R2
|
||||||
|
Pop $R1
|
||||||
|
Exch $R0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
# 只能重复实现一遍,因为 un.FindIt 只能用在卸载过程中,这是 nsis 的命名限制
|
||||||
|
!macro FindIt In For Result
|
||||||
|
Push "${In}"
|
||||||
|
Push "${For}"
|
||||||
|
Call FindIt
|
||||||
|
Pop "${Result}"
|
||||||
|
!macroend
|
||||||
|
!define FindIt "!insertmacro FindIt"
|
||||||
|
|
||||||
|
Function FindIt
|
||||||
|
Exch $R0
|
||||||
|
Exch
|
||||||
|
Exch $R1
|
||||||
|
Push $R2
|
||||||
|
Push $R3
|
||||||
|
Push $R4
|
||||||
|
Push $R5
|
||||||
|
Push $R6
|
||||||
|
|
||||||
|
StrCpy $R6 -1
|
||||||
|
StrCpy $R3 1
|
||||||
|
|
||||||
|
Push $R1
|
||||||
|
|
||||||
|
nextDir:
|
||||||
|
Pop $R1
|
||||||
|
IntOp $R3 $R3 - 1
|
||||||
|
ClearErrors
|
||||||
|
FindFirst $R5 $R2 "$R1\*.*"
|
||||||
|
|
||||||
|
nextFile:
|
||||||
|
StrCmp $R2 "." gotoNextFile
|
||||||
|
StrCmp $R2 ".." gotoNextFile
|
||||||
|
|
||||||
|
StrCmp $R2 $R0 0 isDir
|
||||||
|
StrCpy $R6 "$R1\$R2"
|
||||||
|
loop:
|
||||||
|
StrCmp $R3 0 done
|
||||||
|
Pop $R1
|
||||||
|
IntOp $R3 $R3 - 1
|
||||||
|
Goto loop
|
||||||
|
|
||||||
|
isDir:
|
||||||
|
|
||||||
|
IfFileExists "$R1\$R2\*.*" 0 gotoNextFile
|
||||||
|
IntOp $R3 $R3 + 1
|
||||||
|
Push "$R1\$R2"
|
||||||
|
|
||||||
|
gotoNextFile:
|
||||||
|
FindNext $R5 $R2
|
||||||
|
IfErrors 0 nextFile
|
||||||
|
|
||||||
|
done:
|
||||||
|
FindClose $R5
|
||||||
|
StrCmp $R3 0 0 nextDir
|
||||||
|
StrCpy $R0 $R6
|
||||||
|
|
||||||
Pop $R6
|
Pop $R6
|
||||||
Pop $R5
|
Pop $R5
|
||||||
Pop $R4
|
Pop $R4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue