mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-26 06:50:06 +00:00
Implement File_Util::GetFileModificationTimestamp function
This commit is contained in:
parent
3a1eaf2efc
commit
4021ed79d9
@ -100,6 +100,22 @@ bool Exists(const std::string& filename) {
|
|||||||
return (result == 0);
|
return (result == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u64 GetFileModificationTimestamp(const std::string& filepath) {
|
||||||
|
|
||||||
|
if (FileUtil::Exists(filepath)) {
|
||||||
|
struct stat64 file_info;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (0 == _wstat64(Common::UTF8ToUTF16W(filepath).c_str(), &file_info)) {
|
||||||
|
#else
|
||||||
|
if (0 == stat64(filepath.c_str(), &file_info)) {
|
||||||
|
#endif
|
||||||
|
return static_cast<u64>(file_info.st_mtime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if filename is a directory
|
// Returns true if filename is a directory
|
||||||
bool IsDirectory(const std::string& filename) {
|
bool IsDirectory(const std::string& filename) {
|
||||||
struct stat file_info;
|
struct stat file_info;
|
||||||
|
@ -63,6 +63,14 @@ struct FSTEntry {
|
|||||||
// Returns true if file filename exists
|
// Returns true if file filename exists
|
||||||
bool Exists(const std::string& filename);
|
bool Exists(const std::string& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetFileModificationTimestamp
|
||||||
|
* Return file timestamp if the file exists, return 0 if file no exists
|
||||||
|
* Note :
|
||||||
|
* Timestamp format: milliseconds since the Unix epoch
|
||||||
|
*/
|
||||||
|
u64 GetFileModificationTimestamp(const std::string& filepath);
|
||||||
|
|
||||||
// Returns true if filename is a directory
|
// Returns true if filename is a directory
|
||||||
bool IsDirectory(const std::string& filename);
|
bool IsDirectory(const std::string& filename);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user