aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/frontend/frontend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/frontend/frontend.cpp')
-rw-r--r--src/zenserver/frontend/frontend.cpp65
1 files changed, 39 insertions, 26 deletions
diff --git a/src/zenserver/frontend/frontend.cpp b/src/zenserver/frontend/frontend.cpp
index 149d97924..b743ca939 100644
--- a/src/zenserver/frontend/frontend.cpp
+++ b/src/zenserver/frontend/frontend.cpp
@@ -4,6 +4,8 @@
#include <zencore/endian.h>
#include <zencore/filesystem.h>
+#include <zencore/fmtutils.h>
+#include <zencore/logging.h>
#include <zencore/string.h>
ZEN_THIRD_PARTY_INCLUDES_START
@@ -23,50 +25,61 @@ HttpFrontendService::HttpFrontendService(std::filesystem::path Directory) : m_Di
IoBuffer SelfBuffer = IoBufferBuilder::MakeFromFile(SelfPath);
m_ZipFs = ZipFs(std::move(SelfBuffer));
-#if ZEN_BUILD_DEBUG
- if (!Directory.empty())
+ if (m_Directory.empty() && !m_ZipFs)
{
- return;
- }
+ // Probe for development layout
- std::error_code ErrorCode;
- auto Path = SelfPath;
- while (Path.has_parent_path())
- {
- auto ParentPath = Path.parent_path();
- if (ParentPath == Path)
- {
- break;
- }
- if (std::filesystem::is_regular_file(ParentPath / "xmake.lua", ErrorCode))
+ std::error_code ErrorCode;
+ std::filesystem::path Path = SelfPath;
+
+ while (Path.has_parent_path())
{
- if (ErrorCode)
+ std::filesystem::path ParentPath = Path.parent_path();
+ if (ParentPath == Path)
{
break;
}
-
- auto HtmlDir = ParentPath / "zenserver" / "frontend" / "html";
- if (std::filesystem::is_directory(HtmlDir, ErrorCode))
+ if (std::filesystem::is_regular_file(ParentPath / "xmake.lua", ErrorCode))
{
- m_Directory = HtmlDir;
+ if (ErrorCode)
+ {
+ break;
+ }
+
+ std::filesystem::path HtmlDir = ParentPath / "src" / "zenserver" / "frontend" / "html";
+
+ if (std::filesystem::is_directory(HtmlDir, ErrorCode))
+ {
+ m_Directory = HtmlDir;
+ }
+ break;
}
- break;
+ Path = ParentPath;
}
- Path = ParentPath;
- };
-#endif
+ }
+
+ if (m_ZipFs)
+ {
+ ZEN_INFO("front-end is served from embedded zip");
+ }
+ else if (!m_Directory.empty())
+ {
+ ZEN_INFO("front-end is served from '{}'", m_Directory);
+ }
+ else
+ {
+ ZEN_INFO("front-end is NOT AVAILABLE");
+ }
}
-////////////////////////////////////////////////////////////////////////////////
HttpFrontendService::~HttpFrontendService()
{
}
-////////////////////////////////////////////////////////////////////////////////
const char*
HttpFrontendService::BaseUri() const
{
- return "/dashboard"; // in order to use the root path we need to remove HttpAddUrlToUrlGroup in HttpSys.cpp
+ return "/dashboard/"; // in order to use the root path we need to remove HttpAddUrlToUrlGroup in HttpSys.cpp
}
////////////////////////////////////////////////////////////////////////////////