nall: File timestamp fix for OpenBSD and DragonFly BSD, add DragonFly BSD to PLATFORM_BSD definition

This commit is contained in:
Rupert Carmichael 2021-07-31 21:41:35 -04:00 committed by Screwtapello
parent 3ccb543622
commit 063e645ff2
2 changed files with 7 additions and 1 deletions

View File

@ -82,6 +82,12 @@ struct inode {
#if defined(PLATFORM_WINDOWS) #if defined(PLATFORM_WINDOWS)
//on Windows, the last status change time (ctime) holds the file creation time instead //on Windows, the last status change time (ctime) holds the file creation time instead
case time::create: return data.st_ctime; case time::create: return data.st_ctime;
#elif defined(__OpenBSD__)
// OpenBSD is a special case that must be handled separately from other BSDs
case time::create: return min((uint)data.__st_birthtime, (uint)data.st_mtime);
#elif defined (__DragonFly__)
// DragonFly BSD does not support file creation time, use modified time instead
case time::create: return data.st_mtime;
#elif defined(PLATFORM_BSD) || defined(PLATFORM_MACOS) #elif defined(PLATFORM_BSD) || defined(PLATFORM_MACOS)
//st_birthtime may return -1 or st_atime if it is not supported by the file system //st_birthtime may return -1 or st_atime if it is not supported by the file system
//the best that can be done in this case is to return st_mtime if it's older //the best that can be done in this case is to return st_mtime if it's older

View File

@ -98,7 +98,7 @@ namespace nall {
constexpr auto platform() -> Platform { return Platform::Linux; } constexpr auto platform() -> Platform { return Platform::Linux; }
constexpr auto api() -> API { return API::Posix; } constexpr auto api() -> API { return API::Posix; }
constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; } constexpr auto display() -> DisplayServer { return DisplayServer::Xorg; }
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined (__DragonFly__)
#define PLATFORM_BSD #define PLATFORM_BSD
#define API_POSIX #define API_POSIX
#define DISPLAY_XORG #define DISPLAY_XORG