diff --git a/Source/ZenLib/Conf.h b/Source/ZenLib/Conf.h index 14d4d5a..792f313 100644 --- a/Source/ZenLib/Conf.h +++ b/Source/ZenLib/Conf.h @@ -88,6 +88,20 @@ #endif #endif +//--------------------------------------------------------------------------- +//Linux +#if defined(__LINUX__) || defined(__linux__) + #ifndef LINUX + #define LINUX + #endif + #ifndef _LINUX + #define _LINUX + #endif + #ifndef __LINUX__ + #define __LINUX__ 1 + #endif +#endif + //--------------------------------------------------------------------------- //MacOS Classic #if defined(macintosh) diff --git a/Source/ZenLib/File.cpp b/Source/ZenLib/File.cpp index 1dee65f..75c0bc5 100644 --- a/Source/ZenLib/File.cpp +++ b/Source/ZenLib/File.cpp @@ -30,6 +30,11 @@ #include #if !defined(WINDOWS) #include + #if defined(LINUX) + #include + #include + #include + #endif #endif //!defined(WINDOWS) #include using namespace std; @@ -1080,7 +1085,23 @@ Ztring File::Created_Get() return __T(""); //Not implemented #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD - return __T(""); //Not implemented + #if defined LINUX && defined STATX_BTIME + struct statx Stat; + int Result=statx(AT_FDCWD, File_Name.To_Local().c_str(), AT_STATX_SYNC_AS_STAT, STATX_BTIME, &Stat); + if (Result<0) + return __T(""); //Error + Ztring Time; Time.Date_From_Seconds_1970((int64s)Stat.stx_btime.tv_sec); + return Time; + #elif defined MACOS || defined MACOSX + struct stat Stat; + int Result=stat(File_Name.To_Local().c_str(), &Stat); + if (Result<0) + return __T(""); //Error + Ztring Time; Time.Date_From_Seconds_1970((int64s)Stat.st_birthtime); + return Time; + #else + return __T(""); //Not implemented + #endif //defined LINUX && defined STATX_BTIME #elif defined WINDOWS #ifdef WINDOWS_UWP ComPtr Item; @@ -1149,7 +1170,23 @@ Ztring File::Created_Local_Get() return __T(""); //Not implemented #else //ZENLIB_USEWX #ifdef ZENLIB_STANDARD - return __T(""); //Not implemented + #if defined LINUX && defined STATX_BTIME + struct statx Stat; + int Result=statx(AT_FDCWD, File_Name.To_Local().c_str(), AT_STATX_SYNC_AS_STAT, STATX_BTIME, &Stat); + if (Result<0) + return __T(""); //Error + Ztring Time; Time.Date_From_Seconds_1970_Local(Stat.stx_btime.tv_sec); + return Time; + #elif defined MACOS || defined MACOSX + struct stat Stat; + int Result=stat(File_Name.To_Local().c_str(), &Stat); + if (Result<0) + return __T(""); //Error + Ztring Time; Time.Date_From_Seconds_1970_Local((int64s)Stat.st_birthtime); + return Time; + #else + return __T(""); //Not implemented + #endif //defined LINUX && defined STATX_BTIME #elif defined WINDOWS #ifdef WINDOWS_UWP ComPtr Item;