(trunk libT) move torrent.c's private function fileExists() to the utility function tr_fileExists() so that it can also be used by stats.c

This commit is contained in:
Jordan Lee
2012-07-01 03:05:36 +00:00
parent 3398a48e57
commit f55ab8dddb
3 changed files with 28 additions and 28 deletions

View File

@@ -638,6 +638,24 @@ tr_buildPath( const char *first_element, ... )
return buf;
}
#ifdef SYS_DARWIN
#define TR_STAT_MTIME(sb) ((sb).st_mtimespec.tv_sec)
#else
#define TR_STAT_MTIME(sb) ((sb).st_mtime)
#endif
bool
tr_fileExists( const char * filename, time_t * mtime )
{
struct stat sb;
const bool ok = !stat( filename, &sb );
if( ok && ( mtime != NULL ) )
*mtime = TR_STAT_MTIME( sb );
return ok;
}
/****
*****
****/