Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-07-16 19:59:57 +03:00
1 parent 8aa968eb9f
commit 11850b1a8d
11 files changed
+1569 -160

No files matched your search

+31 -11
View File
@@ -2,20 +2,40 @@
#include <Types.hpp>
#include <cstdint>
#include <filesystem>
#include <string>
#include <vector>
namespace Echoion::Standalone
{
struct ReleaseManifest {
std::string version;
std::filesystem::path executable;
std::filesystem::path core;
std::string executableSha256;
std::string coreSha256;
[[nodiscard]] static Api::Result<ReleaseManifest>
load(const std::filesystem::path& manifestPath);
[[nodiscard]] Api::Result<void> validate() const;
enum class ReleaseFileType : std::uint8_t {
Regular,
Symlink,
};
}
struct ReleaseFileEntry {
std::filesystem::path path;
ReleaseFileType type{ReleaseFileType::Regular};
std::uintmax_t size{};
std::filesystem::perms mode{std::filesystem::perms::unknown};
std::string sha256;
std::filesystem::path target;
};
struct ReleaseManifest {
std::uint32_t schemaVersion{1};
std::string version;
std::filesystem::path root;
std::filesystem::path executable;
std::filesystem::path core;
std::string executableSha256;
std::string coreSha256;
std::vector<ReleaseFileEntry> files;
[[nodiscard]] static Api::Result<ReleaseManifest>
load(const std::filesystem::path& manifestPath);
[[nodiscard]] Api::Result<void> validate() const;
[[nodiscard]] Api::Result<void> validateInstallLayout() const;
};
} // namespace Echoion::Standalone
@@ -0,0 +1,39 @@
#pragma once
#include <expected>
#include <filesystem>
#include <optional>
#include <string>
namespace Echoion::Standalone
{
[[nodiscard]] std::expected<std::filesystem::path, std::string>
runningExecutablePath();
[[nodiscard]] std::filesystem::path deriveInstallRoot(
const std::filesystem::path& executablePath,
const std::optional<std::filesystem::path>& homeOverride =
std::nullopt);
[[nodiscard]] std::filesystem::path resolveCorePath(
const std::filesystem::path& installRoot,
const std::filesystem::path& executableDirectory,
const std::optional<std::filesystem::path>& coreOverride =
std::nullopt);
[[nodiscard]] std::filesystem::path resolveStateDirectory(
const std::optional<std::filesystem::path>& commandLineOverride,
const std::optional<std::filesystem::path>& environmentOverride,
const std::optional<std::filesystem::path>& xdgStateHome,
const std::optional<std::filesystem::path>& userHome,
const std::filesystem::path& fallback);
[[nodiscard]] std::optional<std::filesystem::path> runtimeWorkingDirectory(
const std::filesystem::path& installRoot,
const std::filesystem::path& executableDirectory);
[[nodiscard]] std::expected<std::filesystem::path, std::string>
resolveAvatarCacheDirectory(
const std::filesystem::path& configuredDirectory,
const std::filesystem::path& requestedDirectory = {});
} // namespace Echoion::Standalone