Refactor editor host resource boundary

This commit is contained in:
2026-04-27 23:18:04 +08:00
parent 87df14f47b
commit 603d003684
28 changed files with 447 additions and 228 deletions

View File

@@ -1,7 +1,5 @@
#include "Runtime/EditorWindowScreenshotController.h"
#include "ExecutablePath.h"
#include <chrono>
#include <cstdio>
#include <sstream>
@@ -11,8 +9,10 @@ namespace XCEngine::UI::Editor::App {
namespace {
std::filesystem::path ResolveBuildCaptureRoot(const std::filesystem::path& requestedCaptureRoot) {
std::filesystem::path captureRoot = App::GetExecutableDirectory() / "captures";
std::filesystem::path ResolveBuildCaptureRoot(
const std::filesystem::path& requestedCaptureRoot,
const std::filesystem::path& executableDirectory) {
std::filesystem::path captureRoot = executableDirectory / "captures";
const std::filesystem::path scenarioPath = requestedCaptureRoot.parent_path().filename();
if (!scenarioPath.empty() && scenarioPath != "captures") {
captureRoot /= scenarioPath;
@@ -23,8 +23,10 @@ std::filesystem::path ResolveBuildCaptureRoot(const std::filesystem::path& reque
} // namespace
void EditorWindowScreenshotController::Initialize(const std::filesystem::path& captureRoot) {
m_captureRoot = ResolveBuildCaptureRoot(captureRoot);
void EditorWindowScreenshotController::Initialize(
const std::filesystem::path& captureRoot,
const std::filesystem::path& executableDirectory) {
m_captureRoot = ResolveBuildCaptureRoot(captureRoot, executableDirectory);
m_historyRoot = (m_captureRoot / "history").lexically_normal();
m_latestCapturePath = (m_captureRoot / "latest.png").lexically_normal();
m_activeHistoryCapturePath.clear();