Search code examples
parsinginstallationnsis

FindLine Function doesn't look at all lines


I am using the NSIS function LineFind.

My Problem: The function LineFind is only searching the 1st line of a file then stopping. Its not going onto the next line of the file till the end. Isn't the function meant to search EVERY line of the file for my TargetLine?

How can I get LineFind to search EVERY line and not just the 1st line?

Function FindLineCallback
    # Only ever prints out the first line and never runs this function again
    DetailPrint "LINE: $R9"

    ...Unrelated code to check line
FunctionEnd

Function FindLine
    # TOP = Top of stack
    # T-2 = mDir
    # T-1 = mFile
    # TOP = targetStr

    Pop $R8  # targetStr
    Pop $R7  # mFile
    Pop $R6  # mDir 

    ${LineFind} "$R6\$R7" "" "1:-1" "FindLineCallback"

FunctionEnd

Solution

  • Found the answer: I just need to Push a number value at the end of the callback function to "signal" that I want to continue looking

    Function FindLineCallback
        DetailPrint "LINE: $R9"
    
        Push 2
    FunctionEnd