MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / GetFileDateAndSize

Function GetFileDateAndSize

external/ImGuiFileDialog/ImGuiFileDialog.cpp:888–917  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886 return false;
887 }
888 void GetFileDateAndSize(const std::string& vFilePathName, const IGFD::FileType& vFileType, std::string& voDate, size_t& voSize) override {
889 struct stat statInfos{};
890 int32_t result{};
891#ifdef _IGFD_WIN_
892 std::wstring wfpn = IGFD::Utils::UTF8Decode(vFilePathName);
893 result = _wstati64(wfpn.c_str(), &statInfos);
894#else
895 result = stat(vFilePathName.c_str(), &statInfos);
896#endif
897 static char timebuf[100];
898 if (!result) {
899 // date
900 size_t len = 0;
901#ifdef _MSC_VER
902 struct tm _tm;
903 errno_t err = localtime_s(&_tm, &statInfos.st_mtime);
904 if (!err) len = strftime(timebuf, 99, DateTimeFormat, &_tm);
905#else // _MSC_VER
906 struct tm* _tm = localtime(&statInfos.st_mtime);
907 if (_tm) len = strftime(timebuf, 99, DateTimeFormat, _tm);
908#endif // _MSC_VER
909 if (len) {
910 voDate = std::string(timebuf, len);
911 }
912 // size
913 if (!vFileType.isDir()) {
914 voSize = (size_t)statInfos.st_size;
915 }
916 }
917 }
918};
919#define FILE_SYSTEM_OVERRIDE FileSystemDirent
920#endif // USE_STD_FILESYSTEM

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
isDirMethod · 0.80
statClass · 0.70

Tested by

no test coverage detected