updated build system

This commit is contained in:
2024-08-23 12:35:48 -05:00
parent c8929fed0b
commit f654d269a7
8 changed files with 36 additions and 55 deletions

View File

@ -314,7 +314,7 @@ void remote_fuse_drive::populate_stat(const remote::stat &r_stat,
unix_st.st_mtimespec.tv_sec = r_stat.st_mtimespec / NANOS_PER_SECOND;
unix_st.st_flags = r_stat.st_flags;
#else
#else // !defined(__APPLE__)
unix_st.st_blksize = 4096;
unix_st.st_atim.tv_nsec =
@ -331,7 +331,8 @@ void remote_fuse_drive::populate_stat(const remote::stat &r_stat,
static_cast<suseconds_t>(r_stat.st_mtimespec % NANOS_PER_SECOND);
unix_st.st_mtim.tv_sec =
static_cast<suseconds_t>(r_stat.st_mtimespec / NANOS_PER_SECOND);
#endif
#endif // defined(__APPLE__)
if (not directory) {
const auto block_size_stat = static_cast<std::uint64_t>(512U);
const auto block_size = static_cast<std::uint64_t>(4096U);

View File

@ -92,10 +92,14 @@ void remote_server::populate_stat(const char *path, bool directory,
directory ? 2 + drive_.get_directory_item_count(
utils::path::create_api_path(path))
: 1);
r_stat.st_atimespec = utils::time::time64_to_unix_time(unix_st.st_atime);
r_stat.st_birthtimespec = utils::time::time64_to_unix_time(unix_st.st_ctime);
r_stat.st_ctimespec = utils::time::time64_to_unix_time(unix_st.st_ctime);
r_stat.st_mtimespec = utils::time::time64_to_unix_time(unix_st.st_mtime);
r_stat.st_atimespec = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(unix_st.st_atime));
r_stat.st_birthtimespec = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(unix_st.st_ctime));
r_stat.st_ctimespec = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(unix_st.st_ctime));
r_stat.st_mtimespec = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(unix_st.st_mtime));
r_stat.st_size = static_cast<remote::file_size>(unix_st.st_size);
r_stat.st_mode = unix_st.st_mode;
}

View File

@ -99,26 +99,15 @@ auto encrypt_provider::create_api_file(
file.modified_date =
buf.st_mtimespec.tv_nsec + (buf.st_mtimespec.tv_sec * NANOS_PER_SECOND);
#elif defined(_WIN32)
auto ft = utils::time::unix_time_to_filetime(
utils::time::time64_to_unix_time(buf.st_atime));
file.accessed_date =
(static_cast<std::uint64_t>(ft.dwHighDateTime) << 32U) | ft.dwLowDateTime;
ft = utils::time::unix_time_to_filetime(
utils::time::time64_to_unix_time(buf.st_mtime));
file.changed_date =
(static_cast<std::uint64_t>(ft.dwHighDateTime) << 32U) | ft.dwLowDateTime;
ft = utils::time::unix_time_to_filetime(
utils::time::time64_to_unix_time(buf.st_ctime));
file.creation_date =
(static_cast<std::uint64_t>(ft.dwHighDateTime) << 32U) | ft.dwLowDateTime;
ft = utils::time::unix_time_to_filetime(
utils::time::time64_to_unix_time(buf.st_mtime));
file.modified_date =
(static_cast<std::uint64_t>(ft.dwHighDateTime) << 32U) | ft.dwLowDateTime;
#else
file.accessed_date = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(buf.st_atime));
file.changed_date = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(buf.st_mtime));
file.creation_date = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(buf.st_ctime));
file.modified_date = utils::time::windows_time_to_unix_time(
static_cast<std::uint64_t>(buf.st_mtime));
#else // !defined(_WIN32)
file.changed_date = static_cast<std::uint64_t>(
buf.st_mtim.tv_nsec + (buf.st_mtim.tv_sec * NANOS_PER_SECOND));
file.accessed_date = static_cast<std::uint64_t>(
@ -127,7 +116,7 @@ auto encrypt_provider::create_api_file(
buf.st_ctim.tv_nsec + (buf.st_ctim.tv_sec * NANOS_PER_SECOND));
file.modified_date = static_cast<std::uint64_t>(
buf.st_mtim.tv_nsec + (buf.st_mtim.tv_sec * NANOS_PER_SECOND));
#endif
#endif // defined(__APPLE__)
return file;
}

View File

@ -245,7 +245,8 @@ auto get_accessed_time(const std::string &path,
#if defined(_WIN32)
struct _stat64 st {};
if (_stat64(path.c_str(), &st) != -1) {
accessed = static_cast<uint64_t>(st.st_atime);
accessed = time::windows_time_to_unix_time(
static_cast<std::uint64_t>(st.st_atime));
#else
struct stat st {};
if (stat(path.c_str(), &st) != -1) {
@ -270,7 +271,8 @@ auto get_modified_time(const std::string &path,
#if defined(_WIN32)
struct _stat64 st {};
if (_stat64(path.c_str(), &st) != -1) {
modified = static_cast<uint64_t>(st.st_mtime);
modified = time::windows_time_to_unix_time(
static_cast<std::uint64_t>(st.st_mtime));
#else
struct stat st {};
if (stat(path.c_str(), &st) != -1) {
@ -293,18 +295,12 @@ auto is_modified_date_older_than(const std::string &path,
auto ret = false;
std::uint64_t modified{};
if (get_modified_time(path, modified)) {
const auto seconds =
std::chrono::duration_cast<std::chrono::seconds>(hours);
#if defined(_WIN32)
return (std::chrono::system_clock::from_time_t(
static_cast<time_t>(modified)) +
seconds) < std::chrono::system_clock::now();
#else
auto seconds = std::chrono::duration_cast<std::chrono::seconds>(hours);
return (modified +
static_cast<std::uint64_t>(seconds.count() * NANOS_PER_SECOND)) <
utils::time::get_time_now();
#endif
}
return ret;
}

View File

@ -22,15 +22,8 @@
#include "utils/utils.hpp"
#include "app_config.hpp"
#include "events/event_system.hpp"
#include "events/events.hpp"
#include "providers/i_provider.hpp"
#include "types/startup_exception.hpp"
#include "utils/com_init_wrapper.hpp"
#include "utils/common.hpp"
#include "utils/path.hpp"
#include "utils/string.hpp"
#include "utils/time.hpp"
namespace repertory::utils {
void calculate_allocation_size(bool directory, std::uint64_t file_size,