Archive: Need to help(Read/write txt-file and definition of a path)?


Need to help(Read/write txt-file and definition of a path)?
Hello all!
I not so well understand in NSIS, help please :)
I am sorry, if it was already discussed. Searched at a forum but the decision of a problem has not seen :(

From seen here, has made:

!include "Locate.nsh"
Name "ListFile"
OutFile "ListFile.exe"

ShowInstDetails show

Section ""
FileOpen $2 $EXEDIR\ListFile.txt w
${locate::Open} "$EXEDIR" "" $R0
loop:
${locate::Find} $R0 $R1 $R2 $R3 $R4 $R5 $R6
StrCmp $R1 '' close
CRCCheck::GenCRC "$R1"
Pop $R7
StrCmp $R4 '' 0 +2
goto +2
FileWrite $2 'File: $R3$\r$\nPath: $R2\$R3$\r$\nCRC: $R7$\r$\n'
goto loop
close:
${locate::Close} $R0
${locate::Unload}
FileClose $2
Exec '"notepad.exe" "$EXEDIR\ListFile.txt"'
SectionEnd


As a result I receive the list of files written down in txt-file with indication CRC and path to file.

In txt-file:
File: 129196134213_0.dat
Path: D:\RunDir\Dir1\129196134213_0.dat
CRC: 1605411789
File: other.ifr
Path: D:\RunDir\Dir1\Dir3\other.ifr
CRC: 2902805570


Interests:
1) As it is possible to read through data from file? (a CRC/name of file)
2) As it is possible to make so, that the path to file would enter the name in txt-file
\Dir1 \196147198_0.dat
Without the indication of a directory from where has been started install a file.
If it is not difficult on an example.

Excuse for my English.

Thanks!


Re: Need to help(Read/write txt-file and definition of a path)?
StrLen $3 "$EXEDIR"
StrCpy $R8 "$R2" "" $3

:)