aboutsummaryrefslogtreecommitdiff
path: root/zenserver
diff options
context:
space:
mode:
Diffstat (limited to 'zenserver')
-rw-r--r--zenserver/frontend/frontend.cpp28
1 files changed, 19 insertions, 9 deletions
diff --git a/zenserver/frontend/frontend.cpp b/zenserver/frontend/frontend.cpp
index e203e0631..1b6fe6378 100644
--- a/zenserver/frontend/frontend.cpp
+++ b/zenserver/frontend/frontend.cpp
@@ -163,20 +163,30 @@ HttpFrontendService::HttpFrontendService(std::filesystem::path Directory) : m_Di
}
std::error_code ErrorCode;
- for (auto Path = SelfPath.parent_path(); !Path.empty(); Path = Path.parent_path())
+ auto Path = SelfPath;
+ while (Path.has_parent_path())
{
- if (!std::filesystem::is_regular_file(Path / "xmake.lua", ErrorCode))
+ auto ParentPath = Path.parent_path();
+ if (ParentPath == Path)
{
- continue;
+ break;
}
-
- auto HtmlDir = (Path / __FILE__).parent_path() / "html";
- if (std::filesystem::is_directory(HtmlDir, ErrorCode))
+ if (std::filesystem::is_regular_file(ParentPath / "xmake.lua", ErrorCode))
{
- m_Directory = HtmlDir;
+ if (ErrorCode)
+ {
+ break;
+ }
+
+ auto HtmlDir = ParentPath / "zenserver" / "frontend" / "html";
+ if (std::filesystem::is_directory(HtmlDir, ErrorCode))
+ {
+ m_Directory = HtmlDir;
+ }
+ break;
}
- break;
- }
+ Path = ParentPath;
+ };
#endif
}