diff options
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | zenserver/frontend/frontend.cpp | 28 |
2 files changed, 20 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 407daff94..8d5a41975 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Bugfix: Fix crash when switching Zen upstream configured via DNS when one endpoint becomes unresposive - Bugfix: Fixed issue where projects would not be discovered via DiscoverProjects due to use of stem() vs filename() - Bugfix: Use "\\\\?\\" prefixed paths on Windows and fix hardcoded path delimiters (UE-141222) +- Bugfix: Safer detection of html folder when running non-bundled executable - Sentry: Added logging of sentry_init error code - Sentry: Attach log file to Sentry error reports - Sentry: Capture capture error/critical log statements as errors in Sentry 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 } |