[physfs] some questions

Alain Baeckeroot alain.baeckeroot at laposte.net
Tue Jan 15 14:54:43 EST 2008


Le jeudi 10 janvier 2008, Ryan C. Gordon a écrit :
> 
> > 1/ We had problem on windows xp, with PHYSFS_getLastModTime
> > it seemed to return something else than the expected date.
> > I don't have windows myself, so i cannot tell more, but i can ask
> > for details if needed.
> 
> Can you get details on what value it reports and what it was supposed to 
> report? We have to convert from the Windows time scale to a Unix one, 
> and it's possible we do it incorrectly.
> 
> Also, what time zone is it failing in? We use the current system's 
> timezone in the conversion, which may be causing issues.
> 
> --ryan.
> 
Here is the code we have:
with linux it works nicely and only shows the latest file,
with windows xp, we stop as soon as we find one file matching our pattern
(begin by filestart.str()="1_" , or "2_" etc....)

        PHYSFS_sint64 t = 0;

        while( ( curfile = readdir( lincityDir ) ) ) { 
            if(std::string( curfile->d_name ).find( filestart.str() ) == 0 ) {
                // && !( curfile->d_type & DT_DIR  ) ) is not portable. So
                // don't create a directoy named 2_ in a savegame-directory or
                // you can no longer load from slot 2.
	        if (t == 0) {
                    recentfile = curfile;
                    t = PHYSFS_getLastModTime(recentfile->d_name);
#ifdef WIN32
		    //something is broken in Windows
		    break;
#endif		    
                } else {
                    if (PHYSFS_getLastModTime(curfile->d_name) > t) {
#ifdef DEBUG
                       	fprintf(stderr," %s is more recent than previous %s\n",
                                                curfile->d_name, recentfile->d_name);
#endif
                        recentfile = curfile;
                        t = PHYSFS_getLastModTime(recentfile->d_name);
                    }
                }
            }
        }

I'll ask for sample values on windows.
Alain




More information about the physfs mailing list