Set the current active runtime when a headset connects

This commit is contained in:
Guillaume Meunier
2024-02-19 23:36:28 +01:00
parent a5a1ad1cbd
commit 9efe3852f4
10 changed files with 180 additions and 41 deletions
+3 -26
View File
@@ -58,6 +58,7 @@
#include "jnipp.h"
#else
#include <signal.h>
#include "utils/xdg_base_directory.h"
#endif
using namespace std::chrono_literals;
@@ -293,30 +294,6 @@ static XrActionType guess_action_type(const std::string & name)
return XR_ACTION_TYPE_FLOAT_INPUT;
}
#ifndef __ANDROID__
static std::filesystem::path get_config_base_dir()
{
const char * xdg_config_home = std::getenv("XDG_CONFIG_HOME");
if (xdg_config_home)
return xdg_config_home;
const char * home = std::getenv("HOME");
if (home)
return std::filesystem::path(home) / ".config";
return ".";
}
static std::filesystem::path get_cache_base_dir()
{
const char * xdg_cache_home = std::getenv("XDG_CACHE_HOME");
if (xdg_cache_home)
return xdg_cache_home;
const char * home = std::getenv("HOME");
if (home)
return std::filesystem::path(home) / ".cache";
return ".";
}
#endif
VkBool32 application::vulkan_debug_report_callback(
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objectType,
@@ -927,8 +904,8 @@ application::application(application_info info) :
}
#else
config_path = get_config_base_dir() / "wivrn";
cache_path = get_cache_base_dir() / "wivrn";
config_path = xdg_config_home() / "wivrn";
cache_path = xdg_cache_home() / "wivrn";
#endif
std::filesystem::create_directories(config_path);