vrpathregistry_public.h (1500B)
1 //========= Copyright Valve Corporation ============// 2 #pragma once 3 4 #include <string> 5 #include <vector> 6 #include <stdint.h> 7 8 static const char *k_pchRuntimeOverrideVar = "VR_OVERRIDE"; 9 static const char *k_pchConfigOverrideVar = "VR_CONFIG_PATH"; 10 static const char *k_pchLogOverrideVar = "VR_LOG_PATH"; 11 12 class CVRPathRegistry_Public 13 { 14 public: 15 static std::string GetVRPathRegistryFilename(); 16 static std::string GetOpenVRConfigPath(); 17 18 public: 19 CVRPathRegistry_Public(); 20 21 /** Returns paths using the path registry and the provided override values. Pass NULL for any paths you don't care about. 22 * Returns false if the path registry could not be read. Valid paths might still be returned based on environment variables. */ 23 static bool GetPaths( std::string *psRuntimePath, std::string *psConfigPath, std::string *psLogPath, const char *pchConfigPathOverride, const char *pchLogPathOverride, std::vector<std::string> *pvecExternalDrivers = NULL ); 24 25 bool BLoadFromFile( std::string *psError = nullptr ); 26 bool BSaveToFile() const; 27 28 bool ToJsonString( std::string &sJsonString ); 29 30 // methods to get the current values 31 std::string GetRuntimePath() const; 32 std::string GetConfigPath() const; 33 std::string GetLogPath() const; 34 35 protected: 36 typedef std::vector< std::string > StringVector_t; 37 38 // index 0 is the current setting 39 StringVector_t m_vecRuntimePath; 40 StringVector_t m_vecLogPath; 41 StringVector_t m_vecConfigPath; 42 43 // full list of external drivers 44 StringVector_t m_vecExternalDrivers; 45 };