<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV>I do it slightly differently – I have a dedicated loader program which can
update a number of files and programs in one go. It runs as the
startup/splash screen for the main app menu.</DIV>
<DIV> </DIV>
<DIV>Updated programs are in an update folder,</DIV>
<DIV>working programs are in a (local) folder</DIV>
<DIV> </DIV>
<DIV>It does:</DIV>
<DIV>-Reads a list of files to check</DIV>
<DIV>-copies any newer files from the update folder to the working folder</DIV>
<DIV>-because it only copies newer files it is fast.</DIV>
<DIV>-checks the dates and times of all files afterwards, and retries a second
way if any discrepancies. Logs progress and errors. Warns if
any not latest.</DIV>
<DIV>-runs the main menu program and quits.</DIV>
<DIV> </DIV>
<DIV>-Main menu also periodically checks same list for pending updates and turns
the “get updates” button bright yellow.</DIV>
<DIV>-If “Get updates” clicked it runs the updater program and quits.</DIV>
<DIV> </DIV>
<DIV>Main smart is to check date and time file stamps are within 10 seconds to
be the same. Different file systems have different time
granularities (FAT32 I think is around 2 seconds and NTFS is milliseconds I
think) so if you copy from one to another the dates and times will likely be
slightly different if update and working folders are on different
filesystems.</DIV>
<DIV> </DIV>
<DIV>(Also the updater program is the only one run from the updates folder – all
others from working folder)</DIV>
<DIV> </DIV>
<DIV>This sort of scheme is used by Firefox too – it runs a program updater.exe
and quits, updater.exe does the updates (usually a number of
files are updated), and then runs firefox again.</DIV>
<DIV> </DIV>
<DIV>function xfFilesChanged(file1: string; file2: string): integer;</DIV>
<DIV>//check 2 files modification date</DIV>
<DIV>//returns 0=both files same, 1=file1 later, 2=file2 later</DIV>
<DIV>//if within 10secs counted as same</DIV>
<DIV>//note if one file does not exist, returns other as later</DIV>
<DIV>var</DIV>
<DIV> fileage1, fileage2: integer;</DIV>
<DIV> dtdate1, dtdate2, dt10secs: TDateTime;</DIV>
<DIV>begin</DIV>
<DIV> result := 0;</DIV>
<DIV> fileage1 := FileAge(file1);</DIV>
<DIV> fileage2 := FileAge(file2);</DIV>
<DIV> if (fileage1 < 0) and (fileage2 > 0) then</DIV>
<DIV> begin</DIV>
<DIV> result := 2;</DIV>
<DIV> exit;</DIV>
<DIV> end;</DIV>
<DIV> if (fileage2 < 0) and (fileage1 > 0) then</DIV>
<DIV> begin</DIV>
<DIV> result := 1;</DIV>
<DIV> exit;</DIV>
<DIV> end;</DIV>
<DIV> if (fileage1 < 0) or (fileage2 < 0) then exit; //maybe both
don't exist</DIV>
<DIV> dtdate1 := FileDatetoDateTime(fileage1);</DIV>
<DIV> dtdate2 := FileDatetoDateTime(fileage2);</DIV>
<DIV> if dtdate1 = dtdate2 then</DIV>
<DIV> begin</DIV>
<DIV> result := 0;</DIV>
<DIV> exit;</DIV>
<DIV> end;</DIV>
<DIV> //now if not same, check if within 10 secs</DIV>
<DIV> //in case of different filesystems</DIV>
<DIV> dt10secs := encodetime(0, 0, 10, 0);</DIV>
<DIV> if (dtdate2 > (dtdate1 - dt10secs))</DIV>
<DIV> and (dtdate2 < (dtdate1 + dt10secs)) then</DIV>
<DIV> begin</DIV>
<DIV> result := 0;</DIV>
<DIV> exit;</DIV>
<DIV> end;</DIV>
<DIV> //still different</DIV>
<DIV> if dtdate1 > dtdate2 then result := 1</DIV>
<DIV> else result := 2;</DIV>
<DIV>end;</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">John</DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt"> </DIV>
<DIV style="FONT-FAMILY: 'Arial'; COLOR: #000000; FONT-SIZE: 10pt">
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"><FONT
size=2 face=Arial></FONT></DIV>
<DIV style="FONT: 10pt tahoma">
<DIV style="BACKGROUND: #f5f5f5"><STRONG></STRONG></DIV>
<DIV
style="FONT-STYLE: normal; DISPLAY: inline; FONT-FAMILY: 'Calibri'; COLOR: #000000; FONT-SIZE: small; FONT-WEIGHT: normal; TEXT-DECORATION: none"> </DIV></DIV></DIV></DIV></DIV></BODY></HTML>