aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/hub/hydration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/hub/hydration.cpp')
-rw-r--r--src/zenserver/hub/hydration.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/zenserver/hub/hydration.cpp b/src/zenserver/hub/hydration.cpp
index 0e78f8545..e56be3934 100644
--- a/src/zenserver/hub/hydration.cpp
+++ b/src/zenserver/hub/hydration.cpp
@@ -10,6 +10,8 @@ namespace zen {
///////////////////////////////////////////////////////////////////////////
+constexpr std::string_view FileHydratorPrefix = "file://";
+
struct FileHydrator : public HydrationStrategyBase
{
virtual void Configure(const HydrationConfig& Config) override;
@@ -26,7 +28,8 @@ FileHydrator::Configure(const HydrationConfig& Config)
{
m_Config = Config;
- std::filesystem::path ConfigPath(Utf8ToWide(m_Config.TargetSpecification));
+ std::filesystem::path ConfigPath(Utf8ToWide(m_Config.TargetSpecification.substr(FileHydratorPrefix.length())));
+ MakeSafeAbsolutePathInPlace(ConfigPath);
if (!std::filesystem::exists(ConfigPath))
{
@@ -112,9 +115,15 @@ FileHydrator::Dehydrate()
}
std::unique_ptr<HydrationStrategyBase>
-CreateFileHydrator()
+CreateHydrator(const HydrationConfig& Config)
{
- return std::make_unique<FileHydrator>();
+ if (StrCaseCompare(Config.TargetSpecification.substr(0, FileHydratorPrefix.length()), FileHydratorPrefix) == 0)
+ {
+ std::unique_ptr<HydrationStrategyBase> Hydrator = std::make_unique<FileHydrator>();
+ Hydrator->Configure(Config);
+ return Hydrator;
+ }
+ throw std::runtime_error(fmt::format("Unknown hydration strategy: {}", Config.TargetSpecification));
}
} // namespace zen