diff options
| author | Dan Engelbrecht <[email protected]> | 2022-09-05 11:04:15 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-09-05 02:04:15 -0700 |
| commit | 14d140ee60821463a54dc45576e5c2273d0c2802 (patch) | |
| tree | be7661e11b4c6b61fcc07f8d2364b4fa27b8c61d | |
| parent | Don't use -r option for 7z, it is not needed and picks up more than you expec... (diff) | |
| download | zen-14d140ee60821463a54dc45576e5c2273d0c2802.tar.xz zen-14d140ee60821463a54dc45576e5c2273d0c2802.zip | |
Fix/safer html folder detection (#153)v0.1.4-pre26
* safer detection of html folder for frontend in debug mode
* changelog
| -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 } |