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:
@@ -51,23 +51,23 @@ auto change_to_process_directory() -> bool {
|
||||
#else // !defined(__APPLE__)
|
||||
auto res = readlink("/proc/self/exe", path.data(), path.size());
|
||||
if (res == -1) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to readlink",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to readlink",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
#endif // defined(__APPLE__)
|
||||
path = utils::path::get_parent_path(path);
|
||||
res = chdir(path.c_str());
|
||||
if (res != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to chdir",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to chdir",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
@@ -113,12 +113,12 @@ auto get_free_drive_space(std::string_view path)
|
||||
ULARGE_INTEGER li{};
|
||||
if (not ::GetDiskFreeSpaceEx(std::string{path}.c_str(), &li, nullptr,
|
||||
nullptr)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return li.QuadPart;
|
||||
@@ -127,12 +127,12 @@ auto get_free_drive_space(std::string_view path)
|
||||
#if defined(__linux__)
|
||||
struct statfs64 st {};
|
||||
if (statfs64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return st.f_bfree * static_cast<std::uint64_t>(st.f_bsize);
|
||||
@@ -141,12 +141,12 @@ auto get_free_drive_space(std::string_view path)
|
||||
#if defined(__APPLE__)
|
||||
struct statvfs st {};
|
||||
if (statvfs(path.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get free disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return st.f_bfree * static_cast<std::uint64_t>(st.f_frsize);
|
||||
@@ -209,12 +209,12 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
||||
|
||||
struct _stat64 st {};
|
||||
if (_stat64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get file times",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get file times",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
ret.accessed = utils::time::windows_time_t_to_unix_time(st.st_atime);
|
||||
@@ -224,12 +224,12 @@ auto get_times(std::string_view path) -> std::optional<file_times> {
|
||||
#else // !defined(_WIN32)
|
||||
struct stat64 st {};
|
||||
if (stat64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get file times",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get file times",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
ret.accessed = static_cast<std::uint64_t>(st.st_atim.tv_nsec) +
|
||||
@@ -270,12 +270,12 @@ auto get_total_drive_space(std::string_view path)
|
||||
ULARGE_INTEGER li{};
|
||||
if (not ::GetDiskFreeSpaceEx(std::string{path}.c_str(), nullptr, &li,
|
||||
nullptr)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return li.QuadPart;
|
||||
@@ -284,12 +284,12 @@ auto get_total_drive_space(std::string_view path)
|
||||
#if defined(__linux__)
|
||||
struct statfs64 st {};
|
||||
if (statfs64(std::string{path}.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return st.f_blocks * static_cast<std::uint64_t>(st.f_bsize);
|
||||
@@ -298,12 +298,12 @@ auto get_total_drive_space(std::string_view path)
|
||||
#if defined(__APPLE__)
|
||||
struct statvfs st {};
|
||||
if (statvfs(path.c_str(), &st) != 0) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to get total disk space",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return st.f_blocks * static_cast<std::uint64_t>(st.f_frsize);
|
||||
@@ -424,12 +424,12 @@ auto write_json_file(std::string_view path,
|
||||
try {
|
||||
auto file = file::open_or_create_file(path);
|
||||
if (not file->truncate()) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to truncate file",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(
|
||||
function_name, {
|
||||
"failed to truncate file",
|
||||
std::to_string(utils::get_last_error_code()),
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
#if defined(PROJECT_ENABLE_LIBSODIUM) && defined(PROJECT_ENABLE_BOOST)
|
||||
@@ -503,11 +503,10 @@ auto smb_create_smb_path(std::string_view smb_path,
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
std::string path{rel_path};
|
||||
@@ -524,11 +523,10 @@ auto smb_create_smb_path(std::string_view smb_path,
|
||||
path = "//" + utils::path::format_path(path, "/", "\\");
|
||||
|
||||
if (not validate_smb_path(path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return path;
|
||||
@@ -539,23 +537,22 @@ auto smb_create_and_validate_relative_path(
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
std::string dir_path;
|
||||
if (utils::string::begins_with(path, "//")) {
|
||||
if (not utils::file::smb_parent_is_same(smb_path, path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"failed to validate path",
|
||||
"parent paths are not the same",
|
||||
smb_path,
|
||||
path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name,
|
||||
{
|
||||
"failed to validate path",
|
||||
"parent paths are not the same",
|
||||
smb_path,
|
||||
path,
|
||||
});
|
||||
}
|
||||
|
||||
return utils::file::smb_create_relative_path(path);
|
||||
@@ -569,11 +566,10 @@ auto smb_create_relative_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
std::string path{smb_path};
|
||||
@@ -589,11 +585,10 @@ auto smb_create_search_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
std::string path{smb_path};
|
||||
@@ -610,11 +605,10 @@ auto smb_get_parent_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
auto parts = repertory::utils::string::split(smb_path.substr(2U), '/', false);
|
||||
@@ -624,11 +618,11 @@ auto smb_get_parent_path(std::string_view smb_path) -> std::string {
|
||||
|
||||
auto parent_smb_path = "//" + utils::string::join(parts, '/');
|
||||
if (not validate_smb_path(parent_smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid parent smb path",
|
||||
parent_smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name,
|
||||
{
|
||||
"invalid parent smb path",
|
||||
parent_smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
return parent_smb_path;
|
||||
@@ -638,11 +632,10 @@ auto smb_get_root_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
auto parts = repertory::utils::string::split(smb_path.substr(2U), '/', false);
|
||||
@@ -657,11 +650,10 @@ auto smb_get_unc_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
std::string unc_path{smb_path};
|
||||
@@ -673,11 +665,10 @@ auto smb_get_uri_path(std::string_view smb_path) -> std::string {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
return "smb:" + std::string{smb_path};
|
||||
@@ -688,11 +679,10 @@ auto smb_get_uri_path(std::string_view smb_path, std::string_view user,
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
if (not validate_smb_path(smb_path)) {
|
||||
throw utils::error::create_exception({
|
||||
function_name,
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
throw utils::error::create_exception(function_name, {
|
||||
"invalid smb path",
|
||||
smb_path,
|
||||
});
|
||||
}
|
||||
|
||||
return "smb://" + std::string{user} + ':' + std::string{password} + '@' +
|
||||
|
||||
Reference in New Issue
Block a user