NSIS ${LineRead} 没有提供正确的信息
NSIS ${LineRead} dont give the correct information
对于安装程序,我需要特定的删除功能。
如果我有一个 txt 文件,其中包含我需要删除的所有文件夹。
txt文件是这样建立的:
addon1Success
addon2Success
addon3Failed
我有大约 10 行这样的行。
主要问题是当我打印出我从哪里得到的信息时
${LineRead} - 函数不是像上面那样的行,它是我的测试用例 30 中的数字。
也许我的代码有误:
!include "${NSISDIR}\Include\LogicLib.nsh"
!include "myLogger.nsh" ;
Var i
Function removeFolder
IntOp $i $i * 0
${ForEach} $i 0 $lineCount + 1
${LineRead} "$TEMP\addonInstallerPreFolder\addons\postponeLog.txt" "$i - $i" [=10=]
!insertmacro LOGGER_WRITE "DEBUG Text [=10=]" "0"
${StrContains} [=10=] "Success"
${if} == "Success"
Push "Success"
${else}
Push "Failed"
${endif}
Push [=10=]
Call Slice
Pop $R0
${if} $revertAfter == "true"
CopyFiles "$INSTDIR\addons\backup_$R0\*" "$INSTDIR\addons$R0"
!insertmacro LOGGER_WRITE "Revert Backupfolder to AddonFolder $R0" "0"
${endif}
!insertmacro LOGGER_WRITE "Removed Backup folder of $R0" "0"
Delete "$INSTDIR\addons\backup_$R0"
${next}
FunctionEnd
我希望你能帮助解决我只得到一个数字而不是文本的问题
@克里斯
查看您的代码
${LineRead} "$TEMP\addonInstallerPreFolder\addons\postponeLog.txt" "$i - $i" [=10=]
第一:第三个变量“[LineNumber]”应该是个位数。看起来你有变量 $i - $i。我相信你只需要 "$i".
第二个:文档中的第四个变量
LineRead 函数显示使用 $R0。看起来您在函数中使用了 $0,并且在代码的某些区域使用了 $0,但在其他区域使用了 $R0。
对于安装程序,我需要特定的删除功能。 如果我有一个 txt 文件,其中包含我需要删除的所有文件夹。
txt文件是这样建立的:
addon1Success
addon2Success
addon3Failed
我有大约 10 行这样的行。
主要问题是当我打印出我从哪里得到的信息时
${LineRead} - 函数不是像上面那样的行,它是我的测试用例 30 中的数字。
也许我的代码有误:
!include "${NSISDIR}\Include\LogicLib.nsh"
!include "myLogger.nsh" ;
Var i
Function removeFolder
IntOp $i $i * 0
${ForEach} $i 0 $lineCount + 1
${LineRead} "$TEMP\addonInstallerPreFolder\addons\postponeLog.txt" "$i - $i" [=10=]
!insertmacro LOGGER_WRITE "DEBUG Text [=10=]" "0"
${StrContains} [=10=] "Success"
${if} == "Success"
Push "Success"
${else}
Push "Failed"
${endif}
Push [=10=]
Call Slice
Pop $R0
${if} $revertAfter == "true"
CopyFiles "$INSTDIR\addons\backup_$R0\*" "$INSTDIR\addons$R0"
!insertmacro LOGGER_WRITE "Revert Backupfolder to AddonFolder $R0" "0"
${endif}
!insertmacro LOGGER_WRITE "Removed Backup folder of $R0" "0"
Delete "$INSTDIR\addons\backup_$R0"
${next}
FunctionEnd
我希望你能帮助解决我只得到一个数字而不是文本的问题
@克里斯 查看您的代码
${LineRead} "$TEMP\addonInstallerPreFolder\addons\postponeLog.txt" "$i - $i" [=10=]
第一:第三个变量“[LineNumber]”应该是个位数。看起来你有变量 $i - $i。我相信你只需要 "$i".
第二个:文档中的第四个变量 LineRead 函数显示使用 $R0。看起来您在函数中使用了 $0,并且在代码的某些区域使用了 $0,但在其他区域使用了 $R0。