mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-19 17:10:37 +00:00
savedata: fix dir name search with wildcard (#1552)
* savedata: fix dir name search with wildcard * psf: replace filesystem clock by system clock (utc) * savedatadialog_ui: macOS zoned_time formatting Signed-off-by: Vinicius Rangel <me@viniciusrangel.dev> --------- Signed-off-by: Vinicius Rangel <me@viniciusrangel.dev> Co-authored-by: squidbus <175574877+squidbus@users.noreply.github.com>
This commit is contained in:
parent
96cd79f272
commit
b41664ac61
5 changed files with 49 additions and 14 deletions
|
@ -21,8 +21,13 @@ static inline u32 get_max_size(std::string_view key, u32 default_value) {
|
|||
}
|
||||
|
||||
bool PSF::Open(const std::filesystem::path& filepath) {
|
||||
using namespace std::chrono;
|
||||
if (std::filesystem::exists(filepath)) {
|
||||
last_write = std::filesystem::last_write_time(filepath);
|
||||
const auto t = std::filesystem::last_write_time(filepath);
|
||||
const auto rel =
|
||||
duration_cast<seconds>(t - std::filesystem::file_time_type::clock::now()).count();
|
||||
const auto tp = system_clock::to_time_t(system_clock::now() + seconds{rel});
|
||||
last_write = system_clock::from_time_t(tp);
|
||||
}
|
||||
|
||||
Common::FS::IOFile file(filepath, Common::FS::FileAccessMode::Read);
|
||||
|
@ -99,7 +104,7 @@ bool PSF::Encode(const std::filesystem::path& filepath) const {
|
|||
return false;
|
||||
}
|
||||
|
||||
last_write = std::filesystem::file_time_type::clock::now();
|
||||
last_write = std::chrono::system_clock::now();
|
||||
|
||||
const auto psf_buffer = Encode();
|
||||
const size_t written = file.Write(psf_buffer);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include <filesystem>
|
||||
#include <span>
|
||||
#include <string>
|
||||
|
@ -71,7 +72,7 @@ public:
|
|||
void AddString(std::string key, std::string value, bool update = false);
|
||||
void AddInteger(std::string key, s32 value, bool update = false);
|
||||
|
||||
[[nodiscard]] std::filesystem::file_time_type GetLastWrite() const {
|
||||
[[nodiscard]] std::chrono::system_clock::time_point GetLastWrite() const {
|
||||
return last_write;
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
mutable std::filesystem::file_time_type last_write;
|
||||
mutable std::chrono::system_clock::time_point last_write;
|
||||
|
||||
std::vector<Entry> entry_list;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue