Cleanup active_runtime.json on start
This commit is contained in:
@@ -238,4 +238,20 @@ active_runtime::~active_runtime()
|
|||||||
std::cerr << "Cannot unset active OpenVR runtime: " << e.what() << std::endl;
|
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
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -39,5 +39,7 @@ public:
|
|||||||
|
|
||||||
static std::vector<std::filesystem::path> manifest_path();
|
static std::vector<std::filesystem::path> manifest_path();
|
||||||
static std::filesystem::path openvr_compat_path();
|
static std::filesystem::path openvr_compat_path();
|
||||||
|
|
||||||
|
static void cleanup_openxr();
|
||||||
};
|
};
|
||||||
} // namespace wivrn
|
} // namespace wivrn
|
||||||
|
|||||||
@@ -949,6 +949,8 @@ int inner_main(int argc, char * argv[], bool show_instructions)
|
|||||||
|
|
||||||
std::filesystem::create_directories(socket_path().parent_path());
|
std::filesystem::create_directories(socket_path().parent_path());
|
||||||
|
|
||||||
|
if (do_active_runtime)
|
||||||
|
active_runtime::cleanup_openxr();
|
||||||
listen_socket = create_listen_socket();
|
listen_socket = create_listen_socket();
|
||||||
|
|
||||||
u_trace_marker_init();
|
u_trace_marker_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user