[gameprogrammer] Re: Embedded file monitoring system?
- From: Swalrus <swalrus@xxxxxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 29 Apr 2005 01:29:33 +0200
On Fri, 2005-04-29 at 10:33 +1200, Jake Briggs wrote:
> You could start by having a user initiated check. IE you bind a key
> press to the "lookForAndLoadNewTextures" function. Although that does
> avoid the more interesting part of the problem, how do you know the
> files been changed/added.
Yes, that would be a solution, but unfortunately not a funny one :P
> You could just check the texture directory for its timestamp. On linux,
> if you make a directory at 10 am, then put something in it at 10:30 am
> the time modified omn that directory is updated also. If you modifiy a
> file in the directory, its timestamp is also modified. You would only
> check one thing per frame...
I use Linux and I didn't know it! xD That would definitely improve
performance in case polling was used
Anyway, I've been diving through the Windows API, and I've found this
very interesting function:
HANDLE FindFirstChangeNotification(
LPCTSTR lpPathName,
BOOL bWatchSubtree,
DWORD dwNotifyFilter
);
It lets you wait for file changes in a specified directory (it's more or
less what Kevin suggested).
You can find this function documentation here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/findfirstchangenotification.asp
and a code example here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/obtaining_directory_change_notifications.asp
With this API, polling would be unnecessary in Windows (I guess I've
just found out how did the Bungie guys manage to do it in Halo2).
I will now investigate how to do this kind of thing in Linux (I've
already read something like this in the FAM page...) and MacOSX
Bye!
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Kevin Fields
- References:
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Kevin Fields
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Swalrus
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Jake Briggs
Other related posts:
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- » [gameprogrammer] Re: Embedded file monitoring system?
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Kevin Fields
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Kevin Fields
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Swalrus
- [gameprogrammer] Re: Embedded file monitoring system?
- From: Jake Briggs