mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
(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:
@@ -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;
|
||||
}
|
||||
|
||||
/****
|
||||
*****
|
||||
****/
|
||||
|
||||
Reference in New Issue
Block a user