d/steamvr_lh: Allow overriding steamvr path with environment variable

To support use case such as:

* Non-standard steamvr install path.
* Using older steamvr versions to workaround breakage.
* Using steamvr driver with local modifications.
This commit is contained in:
Yuxuan Shui 2024-02-27 23:27:21 +00:00 committed by Simon Zeni
parent b562e3d35d
commit 7e7e23df7a

View file

@ -713,7 +713,13 @@ steamvr_lh_create_devices(struct xrt_session_event_sink *broadcast,
// The driver likes to create a bunch of transient folder - lets make sure they're created where they normally
// are.
std::filesystem::current_path(STEAM_INSTALL_DIR + "/config/lighthouse");
std::string steamvr = find_steamvr_install();
std::string steamvr{};
if (getenv("STEAMVR_PATH") != nullptr) {
steamvr = getenv("STEAMVR_PATH");
} else {
steamvr = find_steamvr_install();
}
if (steamvr.empty()) {
U_LOG_IFL_E(level, "Could not find where SteamVR is installed!");
return xrt_result::XRT_ERROR_DEVICE_CREATION_FAILED;