updated build system
This commit is contained in:
@@ -50,6 +50,8 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
file_times ret{};
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
auto file_handle = ::CreateFileA(std::string{path}.c_str(), GENERIC_READ, 0,
|
auto file_handle = ::CreateFileA(std::string{path}.c_str(), GENERIC_READ, 0,
|
||||||
nullptr, OPEN_EXISTING, 0, nullptr);
|
nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
@@ -69,46 +71,32 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
|||||||
'|' +
|
'|' +
|
||||||
std::to_string(utils::get_last_error_code()));
|
std::to_string(utils::get_last_error_code()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.accessed = utils::time::windows_file_time_to_unix_time(times.at(1U));
|
||||||
|
ret.created = utils::time::windows_file_time_to_unix_time(times.at(0U));
|
||||||
|
ret.modified = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
||||||
|
ret.written = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
struct stat64 st {};
|
struct stat64 st {};
|
||||||
if (stat64(std::string{path}.c_str(), &st) != 0) {
|
if (stat64(std::string{path}.c_str(), &st) != 0) {
|
||||||
throw std::runtime_error("failed to get file times|" + std::string{path} +
|
throw std::runtime_error("failed to get file times|" + std::string{path} +
|
||||||
'|' + std::to_string(errno));
|
'|' + std::to_string(errno));
|
||||||
}
|
}
|
||||||
#endif // defined(_WIN32)
|
|
||||||
|
|
||||||
file_times ret{};
|
|
||||||
#if defined(_WIN32)
|
|
||||||
ret.accessed = utils::time::windows_file_time_to_unix_time(times.at(1U));
|
|
||||||
#else // !defined(_WIN32)
|
|
||||||
ret.accessed = static_cast<std::uint64_t>(st.st_atim.tv_nsec) +
|
ret.accessed = static_cast<std::uint64_t>(st.st_atim.tv_nsec) +
|
||||||
static_cast<std::uint64_t>(st.st_atim.tv_sec) *
|
static_cast<std::uint64_t>(st.st_atim.tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND;
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
ret.created = utils::time::windows_file_time_to_unix_time(times.at(0U));
|
|
||||||
#else // !defined(_WIN32)
|
|
||||||
ret.created = static_cast<std::uint64_t>(st.st_ctim.tv_nsec) +
|
ret.created = static_cast<std::uint64_t>(st.st_ctim.tv_nsec) +
|
||||||
static_cast<std::uint64_t>(st.st_ctim.tv_sec) *
|
static_cast<std::uint64_t>(st.st_ctim.tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND;
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
ret.modified = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
|
||||||
#else // !defined(_WIN32)
|
|
||||||
ret.modified = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
ret.modified = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
||||||
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND;
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
ret.written = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
|
||||||
#else // !defined(_WIN32)
|
|
||||||
ret.written = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
ret.written = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
||||||
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
||||||
utils::time::NANOS_PER_SECOND;
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::handle_exception(function_name, e);
|
utils::error::handle_exception(function_name, e);
|
||||||
|
@@ -95,7 +95,8 @@ auto directory::copy_to(std::string_view new_path,
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
throw std::runtime_error("failed to copy directory|" + path_ + '|' +
|
throw std::runtime_error("failed to copy directory|" + path_ + '|' +
|
||||||
std::string{new_path} + "|not implemented");
|
std::string{new_path} + '+' +
|
||||||
|
std::to_string(overwrite) + "|not implemented");
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
utils::error::handle_exception(function_name, e);
|
utils::error::handle_exception(function_name, e);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
Reference in New Issue
Block a user