- added beefy new ReadMapList() native
- admin menu now uses ReadMapList() - added UTIL_TrimWhitespace() to stringutils - moved GetFileTime() implementation to ILibrarySys - cleaned up sorting include a bit - removed adminmenu_maplist.ini, since it's specified by maplists.cfg - added maplists.cfg --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401744
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
* Version: $Id$
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
@@ -396,3 +397,32 @@ size_t LibrarySystem::GetFileFromPath(char *buffer, size_t maxlength, const char
|
||||
/* We scanned and found no path separator */
|
||||
return UTIL_Format(buffer, maxlength, "%s", path);
|
||||
}
|
||||
|
||||
bool LibrarySystem::FileTime(const char *path, FileTimeType type, time_t *pTime)
|
||||
{
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
struct _stat s;
|
||||
if (_stat(path, &s) != 0)
|
||||
#elif defined PLATFORM_POSIX
|
||||
struct stat s;
|
||||
if (stat(path, &s) != 0)
|
||||
#endif
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == FileTime_LastAccess)
|
||||
{
|
||||
*pTime = s.st_atime;
|
||||
}
|
||||
else if (type == FileTime_Created)
|
||||
{
|
||||
*pTime = s.st_ctime;
|
||||
}
|
||||
else if (type == FileTime_LastChange)
|
||||
{
|
||||
*pTime = s.st_mtime;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public:
|
||||
const char *GetFileExtension(const char *filename);
|
||||
bool CreateFolder(const char *path);
|
||||
size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path);
|
||||
bool FileTime(const char *path, FileTimeType type, time_t *pTime);
|
||||
};
|
||||
|
||||
extern LibrarySystem g_LibSys;
|
||||
|
||||
Reference in New Issue
Block a user