diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c index 5bfbaa2edee2acce873a3431907b342289a98f37..160de88e4c90802f0a7504ec846d719ff91761cc 100644 --- a/src/xpdev/dirwrap.c +++ b/src/xpdev/dirwrap.c @@ -1,6 +1,5 @@ -/* dirwrap.c */ - /* Directory-related system-call wrappers */ +// vi: tabstop=4 /* $Id$ */ @@ -389,6 +388,22 @@ void DLLCALL rewinddir(DIR* dir) } #endif /* defined(_MSC_VER) */ +/****************************************************************************/ +/* Returns the creation time of the file 'filename' in time_t format */ +/****************************************************************************/ +time_t DLLCALL fcdate(const char* filename) +{ + struct stat st; + + if(access(filename, 0) < 0) + return -1; + + if(stat(filename, &st) != 0) + return -1; + + return st.st_ctime; +} + /****************************************************************************/ /* Returns the time/date of the file in 'filename' in time_t (unix) format */ /****************************************************************************/ diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h index dd3de391ee8bc5010658abf0cdec21534a3ebc9c..1087bb227f9495a08a035e05dc9480aca0fbd583 100644 --- a/src/xpdev/dirwrap.h +++ b/src/xpdev/dirwrap.h @@ -1,6 +1,5 @@ -/* dirwrap.h */ - /* Directory system-call wrappers */ +// vi: tabstop=4 /* $Id$ */ @@ -220,6 +219,7 @@ DLLEXPORT BOOL DLLCALL fexist(const char *filespec); DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */ DLLEXPORT off_t DLLCALL flength(const char *filename); DLLEXPORT time_t DLLCALL fdate(const char *filename); +DLLEXPORT time_t DLLCALL fcdate(const char* filename); DLLEXPORT int DLLCALL setfdate(const char* filename, time_t t); DLLEXPORT BOOL DLLCALL isdir(const char *filename); DLLEXPORT BOOL DLLCALL isabspath(const char *filename);