SysTime.timeLastModified
Returns the time that the given file was last modified.
Parameters
name | the name of the file to check |
Returns
A
Throws
FileException if the given file does not exist.
Returns the time that the given file was last modified. If the file does not exist, returns returnIfMissing.
A frequent usage pattern occurs in build automation tools such as
make or ant. To check whether filetarget must be rebuilt from file source (i.e., target is
older than source or does not exist), use the comparison below. The code throws a FileException if source does not exist (as it should). On the other hand, the SysTime.min default makes a non-existing target seem infinitely old so the test correctly prompts building it.
Parameters
name | The name of the file to get the modification time for. |
returnIfMissing | The time to return if the given file does not exist. |
Returns
A
SysTime.
Example: -------------------- if (source.timeLastModified >= target.timeLastModified(SysTime.min)) { // must (re)build } else { // target is up-to-date } --------------------