|
When generating a file, the MetaEdit+ generator will look to see if that file already exists. If so, and the generated output would be the same as the contents of the existing file, it will not overwrite the existing file. This ensures that the timestamp of the file is not changed unnecessarily, so incremental build / make works well.
You can also make MetaEdit+ not generate a file if it already exists, even if the contents are different. You can use external…executeBlocking to run a batch/shell file to list all files in the directory, saving the results in a file, and then read that file into a variable with variable...write filename...read close. Here's an example for Windows; a shell script would be similar.
$filename='fileA.txt' subreport '_translators' run
external 'cmd /x /c echo.>dir.txt && dir /b>>dir.txt' executeBlocking
variable 'dir' write filename 'dir.txt' read close
/* $dir contains all files, one per line, with blank line at start & end */ if $dir =~ $filename%wildnl then $filename ' already exists, do not generate it' else $filename ' does not exist, generate it here' endif
You can search $dir for other filenames in a similar way. The "echo.>dir.txt" part makes sure there is a blank line at the start; this is needed because we search for $filename with a newline before and after it, to make sure we don’t mistakenly find "bar.doc" within a line "foobar.docx".
|