Cleanup active_runtime.json on start

This commit is contained in:
Patrick Nicolas committed 2026-06-19 09:27:26 +02:00
1 parent ad9a6beb56
commit 5ca8b4bb43
3 files changed
+20

No files matched your search

+16
View File
@@ -238,4 +238,20 @@ active_runtime::~active_runtime()
std::cerr << "Cannot unset active OpenVR runtime: " << e.what() << std::endl;
}
}
void active_runtime::cleanup_openxr()
{
for (const auto & manifest: manifest_path())
{
auto active_runtime = xdg_config_home() / ("openxr/1/active_runtime" + get_abi(manifest) + ".json");
std::error_code ec;
if (std::filesystem::equivalent(manifest, active_runtime, ec))
{
std::cerr << "Removing stale file " << active_runtime << std::endl;
std::filesystem::remove(active_runtime, ec);
}
std::filesystem::rename(backup_name(manifest), manifest, ec);
}
}
} // namespace wivrn