\
Tips and Tricks
File and Directory
Read a file List
This demonstrates how you could read a file which lists the actual
filenames of files you'd like to include in the msi:
<$DirectoryTree Key="INSTALLDIR" Dir="c:\tmp\aaa" CHANGE="\" PrimaryFolder="Y">
<$ListLoad "TestList.txt" ARRAY="FileList"> ;;Load the file that ists the files we want to include
#{ FOR @@Index = 1 to FileList.0
<$File Source="<??FileList.@@Index>" Destination="[INSTALLDIR]\">
#}
The is the reusable code that the above example uses:
#(
;--- Simple "stub" to call the rexx code --------------------------------
#define ListLoad ;;Version 07.111
#evaluate ^^ ^<$@@Rexx4ListLoad {$?}>^
#)
#DefineRexx '@@Rexx4ListLoad' ;;The rexx code
;--- Work through the file ----------------------------------------------
{$!:#1,ARRAY} ;;List valid parameters
@@ListFile = '{$#1}'; ;;Get passed filename
@@FileCnt = 0;
call FileClose @@ListFile, 'N';
do while lines(@@ListFile) <> 0
;--- Read next line of the file -------------------------------------
@@Line = linein(@@ListFile);
;--- Lets allow some flexability with contents ----------------------
@@Line = ReplaceString(@@Line, '09'x, ' ');
@@Line = strip(@@Line);
;--- Save the value -------------------------------------------------
if @@Line <> '' then
do
;--- Looks OK ---------------------------------------------------
@@FileCnt = @@FileCnt + 1;
{$Array}.@@FileCnt = @@Line;
end;
end;
call FileClose @@ListFile;
{$Array}.0 = @@FileCnt;
#DefineRexx