ReUseX
0.0.5
3D Point Cloud Processing for Building Reuse
Toggle main menu visibility
Loading...
Searching...
No Matches
assets.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2026 Povl Filip Sonne-Frederiksen
2
//
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
5
#pragma once
6
7
// Static-asset serving for `rux gui`.
8
//
9
// The frontend bundle is a *data asset installed next to the binary*, never
10
// embedded in it (issue #265): Phase 2 builds it with Nix into
11
// `share/reusex/gui/` and the server picks it up from there. Until that bundle
12
// exists, a built-in placeholder page stands in so the server is usable and
13
// self-describing on day one.
14
15
#include <filesystem>
16
#include <string>
17
#include <string_view>
18
19
namespace
rux::gui
{
20
31
std::filesystem::path
32
resolve_asset_dir
(
const
std::filesystem::path &override_dir);
33
36
std::filesystem::path
executable_dir
();
37
43
std::string
percent_decode
(std::string_view text);
44
50
std::filesystem::path
resolve_asset
(
const
std::filesystem::path &root,
51
std::string_view url_path);
52
58
bool
looks_like_spa_route
(std::string_view url_path);
59
62
std::string
mime_type_for
(
const
std::filesystem::path &path);
63
68
std::string
placeholder_page
(std::string_view project_name);
69
70
}
// namespace rux::gui
rux::gui
Definition
api.hpp:38
rux::gui::resolve_asset_dir
std::filesystem::path resolve_asset_dir(const std::filesystem::path &override_dir)
Locate the frontend asset directory, in precedence order:
rux::gui::mime_type_for
std::string mime_type_for(const std::filesystem::path &path)
Content type for a file, by extension.
rux::gui::percent_decode
std::string percent_decode(std::string_view text)
Percent-decode a URL path component ("%2e%2e" -> "..").
rux::gui::looks_like_spa_route
bool looks_like_spa_route(std::string_view url_path)
True when a path looks like a client-side route rather than a missing file.
rux::gui::executable_dir
std::filesystem::path executable_dir()
Directory of the running executable, or an empty path if it cannot be determined.
rux::gui::resolve_asset
std::filesystem::path resolve_asset(const std::filesystem::path &root, std::string_view url_path)
Map a request path onto a file inside root.
rux::gui::placeholder_page
std::string placeholder_page(std::string_view project_name)
The built-in landing page served when no asset bundle is installed.
apps
rux
include
gui
assets.hpp
Generated by
1.17.0