MCPcopy Create free account
hub / github.com/aiekick/ImGuiFileDialog / GetFileDateAndSize

Method GetFileDateAndSize

ImGuiFileDialog.cpp:604–625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602 return fs::is_directory(stringToPath(vFilePathName));
603 }
604 void GetFileDateAndSize(const std::string& vFilePathName, const IGFD::FileType& vFileType, std::string& voDate, size_t& voSize) override {
605 namespace fs = std::filesystem;
606 fs::path fpath(vFilePathName);
607 try {
608 // date
609 size_t len{};
610 const auto lastWriteTime = fs::last_write_time(fpath);
611 const auto sctp = std::chrono::time_point_cast<std::chrono::system_clock::duration>( //
612 lastWriteTime - fs::file_time_type::clock::now() + std::chrono::system_clock::now());
613 const auto cftime = std::chrono::system_clock::to_time_t(sctp);
614 static char timebuf[100];
615 std::strftime(timebuf, sizeof(timebuf), DateTimeFormat, std::localtime(&cftime));
616 voDate = timebuf;
617 // size
618 if (!vFileType.isDir()) {
619 voSize = fs::file_size(fpath);
620 }
621 } catch (const fs::filesystem_error& e) {
622 voSize = 0;
623 voDate.clear();
624 }
625 }
626};
627#define FILE_SYSTEM_OVERRIDE FileSystemStd
628#else

Callers 1

m_CompleteFileInfosMethod · 0.45

Calls 2

isDirMethod · 0.80
clearMethod · 0.80

Tested by

no test coverage detected