The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

d/steamvr_lh: catch errors when reading libraryfolders.vdf

Prevents abort when libraryfolders.vdf doesn't exist.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2489>

authored by

Sapphire and committed by
Marge Bot
c6da7195 4dbb5881

+14 -1
+14 -1
src/xrt/drivers/steamvr_lh/steamvr_lh.cpp
··· 61 61 find_steamvr_install() 62 62 { 63 63 using namespace tyti; 64 + u_logging_level level = debug_get_log_option_lh_log(); 64 65 std::ifstream file(STEAM_INSTALL_DIR + "/steamapps/libraryfolders.vdf"); 65 - auto root = vdf::read(file); 66 + if (!file.is_open()) { 67 + U_LOG_IFL_E(level, "Failed to open libraryfolders.vdf"); 68 + return std::string(); 69 + } 70 + 71 + vdf::basic_object<char> root; 72 + try { 73 + root = vdf::read(file); 74 + } catch (std::exception &ex) { 75 + U_LOG_IFL_E(level, "Failed to read libraryfolders.vdf: %s", ex.what()); 76 + return std::string(); 77 + } 78 + 66 79 assert(root.name == "libraryfolders"); 67 80 for (auto &[_, child] : root.childs) { 68 81 U_LOG_D("Found library folder %s", child->attribs["path"].c_str());