Prepare android support

This commit is contained in:
momo5502
2025-01-13 07:03:56 +01:00
parent e669674be9
commit 6c2a6ff872
4 changed files with 8 additions and 5 deletions

View File

@@ -2,6 +2,7 @@
#include <span>
#include <vector>
#include <string>
#include <string_view>
#include <stdexcept>
#include <cstring>

View File

@@ -32,7 +32,7 @@ namespace
void register_hive(registry_manager::hive_map& hives, const std::filesystem::path& key,
const std::filesystem::path& file)
{
hives[canonicalize_path(key)] = std::make_unique<hive_parser>(file);
hives[canonicalize_path(key).u16string()] = std::make_unique<hive_parser>(file);
}
}
@@ -95,7 +95,7 @@ std::filesystem::path registry_manager::normalize_path(const std::filesystem::pa
void registry_manager::add_path_mapping(const std::filesystem::path& key, const std::filesystem::path& value)
{
this->path_mapping_[canonicalize_path(key)] = canonicalize_path(value);
this->path_mapping_[canonicalize_path(key).u16string()] = canonicalize_path(value);
}
std::optional<registry_key> registry_manager::get_key(const std::filesystem::path& key)
@@ -137,7 +137,7 @@ std::optional<registry_value> registry_manager::get_value(const registry_key& ke
{
utils::string::to_lower_inplace(name);
const auto iterator = this->hives_.find(key.hive);
const auto iterator = this->hives_.find(key.hive.u16string());
if (iterator == this->hives_.end())
{
return std::nullopt;

View File

@@ -33,7 +33,7 @@ class registry_manager
{
public:
using hive_ptr = std::unique_ptr<hive_parser>;
using hive_map = std::unordered_map<std::filesystem::path, hive_ptr>;
using hive_map = std::unordered_map<std::u16string, hive_ptr>;
registry_manager();
registry_manager(const std::filesystem::path& hive_path);
@@ -54,7 +54,7 @@ class registry_manager
private:
std::filesystem::path hive_path_{};
hive_map hives_{};
std::unordered_map<std::filesystem::path, std::filesystem::path> path_mapping_{};
std::unordered_map<std::u16string, std::filesystem::path> path_mapping_{};
std::filesystem::path normalize_path(const std::filesystem::path& path) const;
void add_path_mapping(const std::filesystem::path& key, const std::filesystem::path& value);

View File

@@ -34,6 +34,7 @@
#include <map>
#include <set>
#include <list>
#include <span>
#include <array>
#include <deque>
#include <queue>
@@ -52,6 +53,7 @@
#include <stdexcept>
#include <string_view>
#include <unordered_set>
#include <unordered_map>
#include <condition_variable>
#include <cassert>