updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
@ -1,18 +1,18 @@
|
|||||||
set(BINUTILS_VERSION 2.41)
|
set(BINUTILS_VERSION 2.41)
|
||||||
set(BOOST_MAJOR_VERSION 1)
|
|
||||||
set(BOOST_MINOR_VERSION 85)
|
|
||||||
set(BOOST_PATCH_VERSION 0)
|
|
||||||
set(BOOST2_MAJOR_VERSION 1)
|
set(BOOST2_MAJOR_VERSION 1)
|
||||||
set(BOOST2_MINOR_VERSION 76)
|
set(BOOST2_MINOR_VERSION 76)
|
||||||
set(BOOST2_PATCH_VERSION 0)
|
set(BOOST2_PATCH_VERSION 0)
|
||||||
|
set(BOOST_MAJOR_VERSION 1)
|
||||||
|
set(BOOST_MINOR_VERSION 85)
|
||||||
|
set(BOOST_PATCH_VERSION 0)
|
||||||
set(CLI11_VERSION 2.4.2)
|
set(CLI11_VERSION 2.4.2)
|
||||||
set(CPP_HTTPLIB_VERSION 0.16.3)
|
set(CPP_HTTPLIB_VERSION 0.16.3)
|
||||||
set(CURL_VERSION 8.9.1)
|
|
||||||
set(CURL2_VERSION 8_9_1)
|
set(CURL2_VERSION 8_9_1)
|
||||||
|
set(CURL_VERSION 8.9.1)
|
||||||
set(CXXOPTS_VERSION 3.2.1)
|
set(CXXOPTS_VERSION 3.2.1)
|
||||||
set(DTL_VERSION 2.01)
|
set(DTL_VERSION 2.01)
|
||||||
set(EXPAT_VERSION 2.6.2)
|
|
||||||
set(EXPAT2_VERSION 2_6_2)
|
set(EXPAT2_VERSION 2_6_2)
|
||||||
|
set(EXPAT_VERSION 2.6.2)
|
||||||
set(FLAC_VERSION 1.4.3)
|
set(FLAC_VERSION 1.4.3)
|
||||||
set(FMT_VERSION 11.0.2)
|
set(FMT_VERSION 11.0.2)
|
||||||
set(FONTCONFIG_VERSION 2.15.0)
|
set(FONTCONFIG_VERSION 2.15.0)
|
||||||
@ -44,8 +44,8 @@ set(SDL_VERSION 2.30.6)
|
|||||||
set(SECP256K1_VERSION 0.1.0.20)
|
set(SECP256K1_VERSION 0.1.0.20)
|
||||||
set(SFML_VERSION 2.6.1)
|
set(SFML_VERSION 2.6.1)
|
||||||
set(SPDLOG_VERSION 1.14.1)
|
set(SPDLOG_VERSION 1.14.1)
|
||||||
set(SQLITE_VERSION 3460100)
|
|
||||||
set(SQLITE2_VERSION 3.46.1)
|
set(SQLITE2_VERSION 3.46.1)
|
||||||
|
set(SQLITE_VERSION 3460100)
|
||||||
set(STDUUID_VERSION 1.2.3)
|
set(STDUUID_VERSION 1.2.3)
|
||||||
set(VLC_VERSION 3.0)
|
set(VLC_VERSION 3.0)
|
||||||
set(VORBIS_VERSION 1.3.7)
|
set(VORBIS_VERSION 1.3.7)
|
||||||
|
@ -52,6 +52,9 @@ auto strptime(const char *s, const char *f, struct tm *tm) -> const char *;
|
|||||||
|
|
||||||
[[nodiscard]] auto unix_time_to_filetime(std::uint64_t unix_time) -> FILETIME;
|
[[nodiscard]] auto unix_time_to_filetime(std::uint64_t unix_time) -> FILETIME;
|
||||||
|
|
||||||
|
[[nodiscard]] auto
|
||||||
|
windows_file_time_to_unix_time(FILETIME win_time) -> std::uint64_t;
|
||||||
|
|
||||||
[[nodiscard]] auto
|
[[nodiscard]] auto
|
||||||
windows_time_t_to_unix_time(__time64_t win_time) -> std::uint64_t;
|
windows_time_t_to_unix_time(__time64_t win_time) -> std::uint64_t;
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "utils/path.hpp"
|
#include "utils/path.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
#include "utils/time.hpp"
|
#include "utils/time.hpp"
|
||||||
|
#include "utils/windows.hpp"
|
||||||
|
|
||||||
namespace repertory::utils::file {
|
namespace repertory::utils::file {
|
||||||
auto get_time(std::string_view path,
|
auto get_time(std::string_view path,
|
||||||
@ -50,46 +51,64 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
struct _stat64 st {};
|
auto file_handle = ::CreateFileA(std::string{path}.c_str(), GENERIC_READ, 0,
|
||||||
auto res = _stat64(std::string{path}.c_str(), &st);
|
nullptr, OPEN_EXISTING, 0, nullptr);
|
||||||
|
if (file_handle == INVALID_HANDLE_VALUE) {
|
||||||
|
throw std::runtime_error("failed to get file times|" + std::string{path} +
|
||||||
|
'|' +
|
||||||
|
std::to_string(utils::get_last_error_code()));
|
||||||
|
}
|
||||||
|
|
||||||
|
std::array<FILETIME, 3U> times{};
|
||||||
|
auto res =
|
||||||
|
::GetFileTime(file_handle, ×.at(0U), ×.at(1U), ×.at(2U));
|
||||||
|
::CloseHandle(file_handle);
|
||||||
|
|
||||||
|
if (not res) {
|
||||||
|
throw std::runtime_error("failed to get file times|" + std::string{path} +
|
||||||
|
'|' +
|
||||||
|
std::to_string(utils::get_last_error_code()));
|
||||||
|
}
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
struct stat st {};
|
struct stat64 st {};
|
||||||
auto res = stat(std::string{path}.c_str(), &st);
|
if (stat64(std::string{path}.c_str(), &st) != 0) {
|
||||||
#endif // defined(_WIN32)
|
|
||||||
if (res != 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{};
|
file_times ret{};
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ret.accessed = utils::time::windows_time_t_to_unix_time(st.st_atime);
|
ret.accessed = utils::time::windows_file_time_to_unix_time(times.at(1U));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
ret.accessed = static_cast<std::uint64_t>(
|
ret.accessed = static_cast<std::uint64_t>(st.st_atim.tv_nsec) +
|
||||||
st.st_atim.tv_nsec + st.st_atim.tv_sec * utils::time::NANOS_PER_SECOND);
|
static_cast<std::uint64_t>(st.st_atim.tv_sec) *
|
||||||
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ret.created = utils::time::windows_time_t_to_unix_time(st.st_ctime);
|
ret.created = utils::time::windows_file_time_to_unix_time(times.at(0U));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
ret.created = static_cast<std::uint64_t>(
|
ret.created = static_cast<std::uint64_t>(st.st_ctim.tv_nsec) +
|
||||||
st.st_ctim.tv_nsec + st.st_ctim.tv_sec * utils::time::NANOS_PER_SECOND);
|
static_cast<std::uint64_t>(st.st_ctim.tv_sec) *
|
||||||
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ret.modified = utils::time::windows_time_t_to_unix_time(st.st_mtime);
|
ret.modified = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
ret.modified = static_cast<std::uint64_t>(
|
ret.modified = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
||||||
st.st_mtim.tv_nsec + st.st_mtim.tv_sec * utils::time::NANOS_PER_SECOND);
|
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
||||||
|
utils::time::NANOS_PER_SECOND;
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
ret.written = utils::time::windows_time_t_to_unix_time(st.st_mtime);
|
ret.written = utils::time::windows_file_time_to_unix_time(times.at(2U));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
ret.written = static_cast<std::uint64_t>(
|
ret.written = static_cast<std::uint64_t>(st.st_mtim.tv_nsec) +
|
||||||
st.st_mtim.tv_nsec + st.st_mtim.tv_sec * utils::time::NANOS_PER_SECOND);
|
static_cast<std::uint64_t>(st.st_mtim.tv_sec) *
|
||||||
|
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);
|
||||||
|
@ -89,6 +89,19 @@ auto traverse_directory(
|
|||||||
namespace repertory::utils::file {
|
namespace repertory::utils::file {
|
||||||
auto directory::copy_to(std::string_view new_path,
|
auto directory::copy_to(std::string_view new_path,
|
||||||
bool overwrite) const -> bool {
|
bool overwrite) const -> bool {
|
||||||
|
static constexpr const std::string_view function_name{
|
||||||
|
static_cast<const char *>(__FUNCTION__),
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
throw std::runtime_error("failed to copy directory|" + path_ + '|' +
|
||||||
|
std::string{new_path} + "|not implemented");
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
utils::error::handle_exception(function_name, e);
|
||||||
|
} catch (...) {
|
||||||
|
utils::error::handle_exception(function_name);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,8 +190,8 @@ auto directory::exists() const -> bool {
|
|||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
return ::PathIsDirectoryA(path_.c_str()) != 0;
|
return ::PathIsDirectoryA(path_.c_str()) != 0;
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
struct stat st {};
|
struct stat64 st {};
|
||||||
return (stat(path_.c_str(), &st) == 0 && S_ISDIR(st.st_mode));
|
return (stat64(path_.c_str(), &st) == 0 && S_ISDIR(st.st_mode));
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -345,7 +358,22 @@ auto directory::is_symlink() const -> bool {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto directory::move_to(std::string_view new_path) -> bool { return false; }
|
auto directory::move_to(std::string_view new_path) -> bool {
|
||||||
|
static constexpr const std::string_view function_name{
|
||||||
|
static_cast<const char *>(__FUNCTION__),
|
||||||
|
};
|
||||||
|
|
||||||
|
try {
|
||||||
|
throw std::runtime_error("failed to move directory|" + path_ + '|' +
|
||||||
|
std::string{new_path} + "|not implemented");
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
utils::error::handle_exception(function_name, e);
|
||||||
|
} catch (...) {
|
||||||
|
utils::error::handle_exception(function_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto directory::remove() -> bool {
|
auto directory::remove() -> bool {
|
||||||
static constexpr const std::string_view function_name{
|
static constexpr const std::string_view function_name{
|
||||||
|
@ -55,8 +55,8 @@ namespace {
|
|||||||
return (::PathFileExistsA(abs_path.c_str()) &&
|
return (::PathFileExistsA(abs_path.c_str()) &&
|
||||||
not ::PathIsDirectoryA(abs_path.c_str()));
|
not ::PathIsDirectoryA(abs_path.c_str()));
|
||||||
#else // !defined(_WIN32)
|
#else // !defined(_WIN32)
|
||||||
struct stat st {};
|
struct stat64 st {};
|
||||||
return (stat(abs_path.c_str(), &st) == 0 && not S_ISDIR(st.st_mode));
|
return (stat64(abs_path.c_str(), &st) == 0 && not S_ISDIR(st.st_mode));
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
@ -118,16 +118,16 @@ auto smb_file::get_time(smb_session *session, smb_tid tid, std::string path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case time_type::access:
|
case time_type::accessed:
|
||||||
return smb_stat_get(st.get(), SMB_STAT_ATIME);
|
return smb_stat_get(st.get(), SMB_STAT_ATIME);
|
||||||
|
|
||||||
case time_type::creation:
|
case time_type::created:
|
||||||
return smb_stat_get(st.get(), SMB_STAT_CTIME);
|
return smb_stat_get(st.get(), SMB_STAT_CTIME);
|
||||||
|
|
||||||
case time_type::modified:
|
case time_type::modified:
|
||||||
return smb_stat_get(st.get(), SMB_STAT_MTIME);
|
return smb_stat_get(st.get(), SMB_STAT_MTIME);
|
||||||
|
|
||||||
case time_type::write:
|
case time_type::written:
|
||||||
return smb_stat_get(st.get(), SMB_STAT_WTIME);
|
return smb_stat_get(st.get(), SMB_STAT_WTIME);
|
||||||
}
|
}
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
|
@ -64,6 +64,12 @@ auto unix_time_to_filetime(std::uint64_t unix_time) -> FILETIME {
|
|||||||
return file_time;
|
return file_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto windows_file_time_to_unix_time(FILETIME win_time) -> std::uint64_t {
|
||||||
|
return windows_time_to_unix_time(
|
||||||
|
(static_cast<std::uint64_t>(win_time.dwHighDateTime) << 32ULL) |
|
||||||
|
static_cast<std::uint64_t>(win_time.dwLowDateTime));
|
||||||
|
}
|
||||||
|
|
||||||
auto windows_time_t_to_unix_time(__time64_t win_time) -> std::uint64_t {
|
auto windows_time_t_to_unix_time(__time64_t win_time) -> std::uint64_t {
|
||||||
return static_cast<std::uint64_t>(
|
return static_cast<std::uint64_t>(
|
||||||
std::chrono::duration_cast<std::chrono::nanoseconds>(
|
std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||||
|
Reference in New Issue
Block a user