windows fixes
This commit is contained in:
@@ -37,15 +37,16 @@ class remote_server final : public virtual remote_server_base<i_winfsp_drive> {
|
|||||||
public:
|
public:
|
||||||
remote_server(app_config &config, i_winfsp_drive &drive,
|
remote_server(app_config &config, i_winfsp_drive &drive,
|
||||||
std::string_view mount_location)
|
std::string_view mount_location)
|
||||||
: remote_server_base(config, drive,
|
: remote_server_base(
|
||||||
utils::string::to_lower(mount_location)) {}
|
config, drive,
|
||||||
|
utils::string::to_lower(std::string{mount_location})) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
directory_cache directory_cache_;
|
directory_cache directory_cache_;
|
||||||
std::atomic<std::uint64_t> next_handle_{0U};
|
std::atomic<std::uint64_t> next_handle_{0U};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
[[nodiscard]] auto construct_path(std::string path) -> std::string;
|
[[nodiscard]] auto construct_path(std::string_view path) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
[[nodiscard]] auto get_next_handle() -> std::uint64_t;
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class i_provider;
|
|||||||
|
|
||||||
class lock_data final {
|
class lock_data final {
|
||||||
public:
|
public:
|
||||||
explicit lock_data(std::string data_directory, provider_type prov,
|
explicit lock_data(std::string_view data_directory, provider_type prov,
|
||||||
std::string unique_id);
|
std::string_view unique_id);
|
||||||
lock_data(const lock_data &) = delete;
|
lock_data(const lock_data &) = delete;
|
||||||
lock_data(lock_data &&) = delete;
|
lock_data(lock_data &&) = delete;
|
||||||
|
|
||||||
|
|||||||
@@ -313,7 +313,8 @@ app_config::app_config(provider_type prov, std::string_view data_directory)
|
|||||||
{
|
{
|
||||||
JSON_ENABLE_MOUNT_MANAGER,
|
JSON_ENABLE_MOUNT_MANAGER,
|
||||||
[this](std::string_view value) {
|
[this](std::string_view value) {
|
||||||
set_enable_mount_manager(utils::string::to_bool(value));
|
set_enable_mount_manager(
|
||||||
|
utils::string::to_bool(std::string{value}));
|
||||||
return utils::string::from_bool(get_enable_mount_manager());
|
return utils::string::from_bool(get_enable_mount_manager());
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -60,13 +60,13 @@ auto remote_server::get_next_handle() -> std::uint64_t {
|
|||||||
return next_handle_;
|
return next_handle_;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto remote_server::construct_path(std::string path) -> std::string {
|
auto remote_server::construct_path(std::string_view path) -> std::string {
|
||||||
path = utils::path::combine(mount_location_, {path});
|
auto ret = utils::path::combine(mount_location_, {path});
|
||||||
if (path == mount_location_) {
|
if (ret == mount_location_) {
|
||||||
path += '\\';
|
ret += '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto remote_server::populate_file_info(std::string_view api_path,
|
auto remote_server::populate_file_info(std::string_view api_path,
|
||||||
|
|||||||
@@ -460,7 +460,7 @@ auto winfsp_drive::get_item_meta(std::string_view api_path,
|
|||||||
api_meta_map meta{};
|
api_meta_map meta{};
|
||||||
auto ret = provider_.get_item_meta(api_path, meta);
|
auto ret = provider_.get_item_meta(api_path, meta);
|
||||||
if (ret == api_error::success) {
|
if (ret == api_error::success) {
|
||||||
value = meta[name];
|
value = meta[std::string{name}];
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -796,7 +796,7 @@ void winfsp_drive::populate_file_info(std::string_view api_path,
|
|||||||
const api_meta_map &meta,
|
const api_meta_map &meta,
|
||||||
FSP_FSCTL_OPEN_FILE_INFO &ofi) const {
|
FSP_FSCTL_OPEN_FILE_INFO &ofi) const {
|
||||||
auto file_path = utils::string::from_utf8(
|
auto file_path = utils::string::from_utf8(
|
||||||
utils::string::replace_copy(api_path, '/', '\\'));
|
utils::string::replace_copy(std::string{api_path}, '/', '\\'));
|
||||||
|
|
||||||
wcscpy_s(ofi.NormalizedName, ofi.NormalizedNameSize / sizeof(WCHAR),
|
wcscpy_s(ofi.NormalizedName, ofi.NormalizedNameSize / sizeof(WCHAR),
|
||||||
file_path.data());
|
file_path.data());
|
||||||
|
|||||||
@@ -31,19 +31,20 @@
|
|||||||
#include "utils/config.hpp"
|
#include "utils/config.hpp"
|
||||||
#include "utils/error_utils.hpp"
|
#include "utils/error_utils.hpp"
|
||||||
#include "utils/hash.hpp"
|
#include "utils/hash.hpp"
|
||||||
|
#include "utils/path.hpp"
|
||||||
#include "utils/string.hpp"
|
#include "utils/string.hpp"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
[[nodiscard]] auto create_lock_key(std::string_view dir_id,
|
[[nodiscard]] auto create_lock_key(std::string_view dir_id,
|
||||||
std::string_view mutex_id) -> std::string {
|
std::string_view mutex_id) -> std::string {
|
||||||
return fmt::format(R"(SOFTWARE\{}\Lock\{}\{})",
|
return fmt::format(R"(SOFTWARE\{}\Lock\{}\{})", REPERTORY_DATA_NAME, dir_id,
|
||||||
repertory::REPERTORY_DATA_NAME, dir_id, mutex_id)
|
mutex_id);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace repertory {
|
namespace repertory {
|
||||||
lock_data::lock_data(std::string_view data_directory, provider_type prov,
|
lock_data::lock_data(std::string_view data_directory, provider_type prov,
|
||||||
std::string unique_id)
|
std::string_view unique_id)
|
||||||
: dir_id_(
|
: dir_id_(
|
||||||
utils::collection::to_hex_string(utils::hash::create_hash_blake2b_64(
|
utils::collection::to_hex_string(utils::hash::create_hash_blake2b_64(
|
||||||
utils::string::to_lower(utils::path::absolute(data_directory))))),
|
utils::string::to_lower(utils::path::absolute(data_directory))))),
|
||||||
|
|||||||
Reference in New Issue
Block a user