XPInstall API Reference:File Object:Methods:modDateChanged
From MDC
Contents |
[edit] modDateChanged
Returns whether file has been modified since a certain date.
[edit] Method of
File object
[edit] Syntax
boolean modDateChanged (FileSpecObject aSourceFolder, Number anOldDate);
[edit] Parameters
The modDateChanged method has the following parameters:
aSourceFolder- A FileSpecObject representing the file to be queried.
anOldDate- A double representing the date.
[edit] Returns
A boolean value indicating whether the file has been modified since the input date or has not.
[edit] Description
Most often, the date passed in as the second parameter in modDateChanged is the returned value from a modDate on a separate file, as in the following example, in which the dates of two files are compared.
[edit] Example
fileSource1 = getFolder("Program", "file1.txt");
fileSource2 = getFolder("Program", "file2.txt");
err1 = File.modDate(fileSource1); // the baseline returned
err2 = File.modDateChanged(fileSource1, err1);
logComment("File.modDateChanged should return 'false' = " + err2);
// the reason it expects false is we're comparing
// the return 'time stamp' value for
// file1.txt with the actual file1.txt itself.
// Thus, no change in 'time stamp' values.
err3 = File.modDateChanged(fileSource2, err1);
logComment("File.modDateChanged should return 'true' = " + err2);
// the reason it expects true is we're comparing
// the return 'time stamp' value for
// file1.txt with another file, file2.txt, with a different
// 'time stamp' value.