windows fixes

This commit is contained in:
2025-10-01 08:47:27 -05:00
parent 8049fa103a
commit 4a360fa1e0
6 changed files with 19 additions and 16 deletions

View File

@@ -37,15 +37,16 @@ class remote_server final : public virtual remote_server_base<i_winfsp_drive> {
public:
remote_server(app_config &config, i_winfsp_drive &drive,
std::string_view mount_location)
: remote_server_base(config, drive,
utils::string::to_lower(mount_location)) {}
: remote_server_base(
config, drive,
utils::string::to_lower(std::string{mount_location})) {}
private:
directory_cache directory_cache_;
std::atomic<std::uint64_t> next_handle_{0U};
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;

View File

@@ -30,8 +30,8 @@ class i_provider;
class lock_data final {
public:
explicit lock_data(std::string data_directory, provider_type prov,
std::string unique_id);
explicit lock_data(std::string_view data_directory, provider_type prov,
std::string_view unique_id);
lock_data(const lock_data &) = delete;
lock_data(lock_data &&) = delete;

View File

@@ -313,7 +313,8 @@ app_config::app_config(provider_type prov, std::string_view data_directory)
{
JSON_ENABLE_MOUNT_MANAGER,
[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());
},
},

View File

@@ -60,13 +60,13 @@ auto remote_server::get_next_handle() -> std::uint64_t {
return next_handle_;
}
auto remote_server::construct_path(std::string path) -> std::string {
path = utils::path::combine(mount_location_, {path});
if (path == mount_location_) {
path += '\\';
auto remote_server::construct_path(std::string_view path) -> std::string {
auto ret = utils::path::combine(mount_location_, {path});
if (ret == mount_location_) {
ret += '\\';
}
return path;
return ret;
}
auto remote_server::populate_file_info(std::string_view api_path,

View File

@@ -460,7 +460,7 @@ auto winfsp_drive::get_item_meta(std::string_view api_path,
api_meta_map meta{};
auto ret = provider_.get_item_meta(api_path, meta);
if (ret == api_error::success) {
value = meta[name];
value = meta[std::string{name}];
}
return ret;
@@ -796,7 +796,7 @@ void winfsp_drive::populate_file_info(std::string_view api_path,
const api_meta_map &meta,
FSP_FSCTL_OPEN_FILE_INFO &ofi) const {
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),
file_path.data());

View File

@@ -31,19 +31,20 @@
#include "utils/config.hpp"
#include "utils/error_utils.hpp"
#include "utils/hash.hpp"
#include "utils/path.hpp"
#include "utils/string.hpp"
namespace {
[[nodiscard]] auto create_lock_key(std::string_view dir_id,
std::string_view mutex_id) -> std::string {
return fmt::format(R"(SOFTWARE\{}\Lock\{}\{})",
repertory::REPERTORY_DATA_NAME, dir_id, mutex_id)
return fmt::format(R"(SOFTWARE\{}\Lock\{}\{})", REPERTORY_DATA_NAME, dir_id,
mutex_id);
}
} // namespace
namespace repertory {
lock_data::lock_data(std::string_view data_directory, provider_type prov,
std::string unique_id)
std::string_view unique_id)
: dir_id_(
utils::collection::to_hex_string(utils::hash::create_hash_blake2b_64(
utils::string::to_lower(utils::path::absolute(data_directory))))),