![]() |
Avoid generating an existing file |
Post Reply
|
| Author | |
stevek
MetaCase
Joined: 11.Mar.2008 Points: 643 |
Post Options
Thanks(0)
Quote Reply
Topic: Avoid generating an existing filePosted: 19.Nov.2010 at 14:20 |
|
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' external 'cmd /x /c echo.>dir.txt && dir /b>>dir.txt' executeBlocking variable 'dir' write /* $dir contains all files, one per line, with blank line at start & end */ 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". |
|
![]() |
|
Post Reply
|
|
| Tweet |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |