Цитата K.A.V.:
Да нет разницы, в каком месте кода будет прописано удаление файлов, главное, чтобы эти файлы не были заняты сторонними процессами »
|
Ну скорее всего инсталлятор и есть тот самый процесс
Код
Код:
;---Definitions----
!define SNAME "EQPortable"
; Best Compression
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On
;----Includes----
!include "ProcessFunc.nsh"
;!include "FileFunc.nsh"
;-----Runtime switches----
CRCCheck off
AutoCloseWindow false
SilentInstall silent
WindowIcon off
;-----Set basic information-----
Name "${SNAME}"
Caption "${SNAME}"
OutFile "..\${SNAME}.exe"
;-----Version Information------
LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
VIProductVersion "1.0.6.0"
VIAddVersionKey ProductName "EQ Portable"
VIAddVersionKey FileDescription "EQPortable"
Section "Main"
${If} ${ProcessExists} "eq.exe"
MessageBox MB_ICONINFORMATION|MB_OK "Программа уже запущена!"
Quit
${Else}
SetShellVarContext current
IfFileExists "$APPDATA\Color\EQ" 0
Rename "$APPDATA\Color" "$APPDATA\Color_Backup"
IfFileExists "$EXEDIR\Data" 0
CopyFiles "$EXEDIR\Data\*.*" "$APPDATA\Color\EQ"
SetShellVarContext all
IfFileExists "$APPDATA\Color\Licenses\EQ" 0
Rename "$APPDATA\Color" "$APPDATA\Color_Backup"
SetOutPath "$APPDATA\Color\Licenses\EQ"
File "License.license"
ExecWait "$EXEDIR\EQ\EQ.exe"
Sleep 400
SetShellVarContext current
CopyFiles "$APPDATA\Color\EQ\*.*" "$EXEDIR\Data"
Sleep 800
RMDir /r "$APPDATA\Color"
IfFileExists "$APPDATA\Color_Backup" 0
Rename "$APPDATA\Color_Backup" "$APPDATA\Color"
SetShellVarContext all
RMDir /r "$APPDATA\Color"
IfFileExists "$APPDATA\Color_Backup" 0
Rename "$APPDATA\Color_Backup" "$APPDATA\Color"
quit
${EndIf}
SectionEnd
;Function .onInstSuccess
;SetShellVarContext all
;RMDir /r "$APPDATA\Color"
;IfFileExists "$APPDATA\Color_Backup" 0
;Rename "$APPDATA\Color_Backup" "$APPDATA\Color"
;FunctionEnd
Проблема в этом куске(не работает):
Скрытый текст
Код:
SetShellVarContext all
RMDir /r "$APPDATA\Color"
IfFileExists "$APPDATA\Color_Backup" 0
Rename "$APPDATA\Color_Backup" "$APPDATA\Color"