legacy-self-manifest-uninstaller.nsi 671 B

1234567891011121314151617181920212223242526272829
  1. Unicode true
  2. Name "Legacy manifest reader"
  3. OutFile "${OUTPUT_FILE}"
  4. InstallDir "$TEMP\legacy-manifest-reader"
  5. RequestExecutionLevel user
  6. SilentInstall silent
  7. !include "LogicLib.nsh"
  8. ; 保留旧包的行为:文件仍打开时删除清单自身会失败,用于验证新外层安装器的兼容。
  9. Section
  10. FileOpen $0 "$INSTDIR\.zcode-install-manifest" r
  11. loop:
  12. ClearErrors
  13. FileRead $0 $1
  14. IfErrors done
  15. StrCpy $1 $1 -2
  16. StrCmp $1 "" loop
  17. StrCpy $2 $1 2
  18. StrCmp $2 ".." loop
  19. ClearErrors
  20. Delete "$INSTDIR\$1"
  21. IfErrors failed
  22. Goto loop
  23. failed:
  24. FileClose $0
  25. SetErrorLevel 2
  26. Quit
  27. done:
  28. FileClose $0
  29. SectionEnd