summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys/vfs_real.cpp
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2021-09-14 05:02:53 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2021-09-14 14:48:01 +0200
commit8d63ebcb645476d8a1efca7957d8308e32b0353c (patch)
tree2767b5659f232f82a80191b970b014364798d7c2 /src/core/file_sys/vfs_real.cpp
parentMerge pull request #7009 from ameerj/main_process_cleanup (diff)
downloadyuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar.gz
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar.bz2
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar.lz
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar.xz
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.tar.zst
yuzu-8d63ebcb645476d8a1efca7957d8308e32b0353c.zip
Diffstat (limited to '')
-rw-r--r--src/core/file_sys/vfs_real.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp
index 3dad54f49..f4073b76a 100644
--- a/src/core/file_sys/vfs_real.cpp
+++ b/src/core/file_sys/vfs_real.cpp
@@ -13,6 +13,13 @@
#include "common/logging/log.h"
#include "core/file_sys/vfs_real.h"
+// For FileTimeStampRaw
+#include <sys/stat.h>
+
+#ifdef _MSC_VER
+#define stat _stat64
+#endif
+
namespace FileSys {
namespace FS = Common::FS;
@@ -392,6 +399,28 @@ std::vector<VirtualFile> RealVfsDirectory::GetFiles() const {
return IterateEntries<RealVfsFile, VfsFile>();
}
+FileTimeStampRaw RealVfsDirectory::GetFileTimeStamp(std::string_view path_) const {
+ const auto full_path = FS::SanitizePath(path + '/' + std::string(path_));
+ const auto fs_path = std::filesystem::path{FS::ToU8String(full_path)};
+ struct stat file_status;
+
+#ifdef _WIN32
+ const auto stat_result = _wstat64(fs_path.c_str(), &file_status);
+#else
+ const auto stat_result = stat(fs_path.c_str(), &file_status);
+#endif
+
+ if (stat_result != 0) {
+ return {};
+ }
+
+ return {
+ .created{static_cast<u64>(file_status.st_ctime)},
+ .accessed{static_cast<u64>(file_status.st_atime)},
+ .modified{static_cast<u64>(file_status.st_mtime)},
+ };
+}
+
std::vector<VirtualDir> RealVfsDirectory::GetSubdirectories() const {
return IterateEntries<RealVfsDirectory, VfsDirectory>();
}