Jump to content
  • Advertisement
Sign in to follow this  
lbzAnalyticaL

File Creation time, cross platform

This topic is 3699 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i am building a cross-platform game, and to keep things small i write most of the underlying libraries myself too. ( i hate large includes/big DLL's! :) ) For my next release i want to include an auto-update program. For this i need file modification times. In Linux (my main platform) the "stat" function provides me with such information, however i am having trouble finding a similar function on windowz. Any ideas? thought's? PS. Game here -> http://www.lbz3d.com

Share this post


Link to post
Share on other sites
Advertisement
http://msdn.microsoft.com/en-us/library/aa365740(VS.85).aspx
or use the stat struct supplied by ms
http://msdn.microsoft.com/en-us/library/221w8e43(VS.80).aspx

[Edited by - CmpDev on June 29, 2008 7:03:18 AM]

Share this post


Link to post
Share on other sites
Not all file systems support this, or even if they support it, it may not be reliable, since the option can be turned off.

You might need to define cross-platform - for example, plenty of platforms don't even use a real file system, or use read-only file system.

Also, relying on time for updates is somewhat futile. Use content to determine what needs to be updated.

Share this post


Link to post
Share on other sites
Agree with the considerations in other posts, that its not necessarily portable functionality and that this type of information might be better recorded in the file.

in linux in c++ i am using boost::filesystem for some things which should be portable to win32 - it can extract the last modification time but not last readtime or creation time which the cli stat tool will report.

code flavour looks like this ...

boost::filesystem::directory_iterator p( dir_path );

boost::posix_time::ptime t
= boost::posix_time::from_time_t( boost::filesystem::last_write_time( *p ));

Share this post


Link to post
Share on other sites
Thank you all for the reply's.

Think i am going to integrate the windows filefind stuff in my file-system backend.
( i already use filefind... just didnt know it provided info too ;) )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!