[DUG] How to replace a file currently in use (Windows)
Paul Heinz
paul at accredo.co.nz
Wed Jan 19 16:09:41 NZDT 2011
John wrote:
> 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.
Yup, we do that too and it's a great technique. We built a tool we
called LaunchGuard. It can 'guard' and update any apps files either
explicitly or via a file containing a list and it can also replicate
directories. You can use it to 'guard' anything.
Happily, it can also create a shortcut against itself for you with the
appropriate parameters and extracts the icon of the app it's 'guarding'
to use on the shortcut to make everything essentially invisible to the
user.
We love LaunchGuard but then you run into the issue of needing to make
the _guarder_ app itself updatable when you add new facilities to it.
It's designed to look in the app directory of anything it's guarding for
a later copy of itself and take the necessary steps.
> -Main menu also periodically checks same list for pending
> updates and turns the "get updates" button bright yellow.
> -If "Get updates" clicked it runs the updater program and quits.
That's a really nice idea for consumer applications. We considered
adding that too but our application is mission critical and often
heavily customised so we don't really want random users updating to
later versions without _some_ IT oversight.
> 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.
Yeah. FAT32 vs NTFS (or ext2/3/etc if it's a Samba box) all have
potentially different filesystem timestamp granularity so 10secs is a
good lowest common denomiator to round-off to.
You can also run into occasional windows network redirector or timezone
gremlins. Thankfully not as bad as it gets with ftp timestamps and
browser ftp clients. (I'm looking at you Internet Explorer!)
Cheers,
Paul.
More information about the Delphi
mailing list