mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 22:20:30 -04:00
prepare linux build target Ubuntu 22, x64
This commit is contained in:
parent
8ef23fe366
commit
0a39f2d3d5
4 changed files with 29 additions and 19 deletions
|
@ -114,6 +114,14 @@ char change_current_directory(const char *path) {
|
|||
return ec == std::error_code{}?1:0;
|
||||
}
|
||||
|
||||
|
||||
std::chrono::system_clock::time_point from_file_time(std::filesystem::file_time_type::clock::time_point tp) {
|
||||
return std::chrono::time_point_cast<std::chrono::system_clock::duration>(
|
||||
tp - std::filesystem::file_time_type::clock::now() + std::chrono::system_clock::now()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
int list_files(const char *directory, int type, LIST_FILES_CALLBACK cb, void *ctx) {
|
||||
std::error_code ec;
|
||||
std::filesystem::directory_iterator iter(std::string(directory), ec);
|
||||
|
@ -130,7 +138,7 @@ int list_files(const char *directory, int type, LIST_FILES_CALLBACK cb, void *ct
|
|||
tmp = entry.path().string();
|
||||
}
|
||||
if (type & file_type_need_timestamp) {
|
||||
auto tm = std::chrono::clock_cast<std::chrono::system_clock>(entry.last_write_time(ec));
|
||||
auto tm = from_file_time(entry.last_write_time(ec));
|
||||
szortm = std::chrono::system_clock::to_time_t(tm);
|
||||
} else {
|
||||
szortm = entry.file_size(ec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue