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
+43
View File
@@ -0,0 +1,43 @@
/*
* WiVRn VR streaming
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
* Copyright (C) 2024 Patrick Nicolas <patricknicolas@laposte.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <filesystem>
#include <cstdlib>
std::filesystem::path xdg_config_home()
{
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 ".";
}
std::filesystem::path xdg_cache_home()
{
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 ".";
}