diff --git a/SandboxProject/Runtime/DataSources.mcruntime b/SandboxProject/Runtime/DataSources.mcruntime index 25dc485..1753d3f 100644 Binary files a/SandboxProject/Runtime/DataSources.mcruntime and b/SandboxProject/Runtime/DataSources.mcruntime differ diff --git a/SandboxProject/Runtime/Diagnostics.mcruntimestate b/SandboxProject/Runtime/Diagnostics.mcruntimestate new file mode 100644 index 0000000..b4ed9ac Binary files /dev/null and b/SandboxProject/Runtime/Diagnostics.mcruntimestate differ diff --git a/SandboxProject/Scenes/Main.mcscene b/SandboxProject/Scenes/Main.mcscene index 3360cce..fbd2154 100644 Binary files a/SandboxProject/Scenes/Main.mcscene and b/SandboxProject/Scenes/Main.mcscene differ diff --git a/SandboxProject/Scenes/Main.mcscene.mcmeta b/SandboxProject/Scenes/Main.mcscene.mcmeta new file mode 100644 index 0000000..2eec4ad --- /dev/null +++ b/SandboxProject/Scenes/Main.mcscene.mcmeta @@ -0,0 +1,6 @@ +{ + "asset_type": "scene", + "guid": "8fc71145-66bd-4481-9b50-4f1bf9c908d7", + "importer": "SceneImporter", + "source_path": "Scenes/Main.mcscene" +} \ No newline at end of file diff --git a/Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataSource.cpp b/Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataSource.cpp index 45edaea..83f1caf 100644 --- a/Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataSource.cpp +++ b/Source/MetaCoreRuntimeData/Private/MetaCoreRuntimeDataSource.cpp @@ -1,4 +1,5 @@ #include "MetaCoreRuntimeData/MetaCoreRuntimeDataSource.h" +#include "MetaCoreFoundation/MetaCoreProject.h" #include #include @@ -119,11 +120,14 @@ constexpr SOCKET MetaCoreInvalidSocket = INVALID_SOCKET; [[nodiscard]] std::string MetaCoreResolveReplayFilePath(const std::string& replayFilePath) { const std::filesystem::path inputPath(replayFilePath); - const std::vector candidates{ - std::filesystem::current_path() / inputPath, - std::filesystem::current_path() / ".." / ".." / ".." / inputPath, - std::filesystem::current_path() / ".." / ".." / ".." / "TestProject" / "Runtime" / inputPath.filename() + std::vector candidates{ + std::filesystem::current_path() / inputPath }; + if (const auto projectRoot = MetaCoreDiscoverProjectRoot()) { + candidates.push_back(*projectRoot / inputPath); + } + candidates.push_back(std::filesystem::current_path() / ".." / ".." / ".." / inputPath); + candidates.push_back(std::filesystem::current_path() / ".." / ".." / ".." / "TestProject" / "Runtime" / inputPath.filename()); for (const auto& candidate : candidates) { std::error_code errorCode; diff --git a/tools/MetaCoreRuntimeConfigTool/main.cpp b/tools/MetaCoreRuntimeConfigTool/main.cpp index bff0034..13a2870 100644 --- a/tools/MetaCoreRuntimeConfigTool/main.cpp +++ b/tools/MetaCoreRuntimeConfigTool/main.cpp @@ -41,7 +41,8 @@ int main(int argc, char* argv[]) { MetaCore::MetaCoreDataSourceSetting{"port", "7001"} } : std::vector{ - MetaCore::MetaCoreDataSourceSetting{"file_path", "TestProject/Runtime/RuntimeReplay.mcstream"} + // 动态计算相对于项目根目录的播放流文件路径,替代原先硬编码的 TestProject + MetaCore::MetaCoreDataSourceSetting{"file_path", (std::filesystem::path(argv[1]).filename() / "RuntimeReplay.mcstream").generic_string()} }, true, 1000