aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_Profile.cpp
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2013-08-16 10:21:36 -0700
committerBrad Davis <[email protected]>2013-08-16 10:21:50 -0700
commitf29e505a7df820e1376d97b41515bdc89d472499 (patch)
tree74c17222d3ab8790c2f004334c8ad5425ecc45e7 /LibOVR/Src/OVR_Profile.cpp
parentda29f23ae3e9b7d8d168fda5d131c11121675b1c (diff)
Official SDK version 0.24
Diffstat (limited to 'LibOVR/Src/OVR_Profile.cpp')
-rw-r--r--LibOVR/Src/OVR_Profile.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/LibOVR/Src/OVR_Profile.cpp b/LibOVR/Src/OVR_Profile.cpp
index 7554a28..83eade3 100644
--- a/LibOVR/Src/OVR_Profile.cpp
+++ b/LibOVR/Src/OVR_Profile.cpp
@@ -46,16 +46,15 @@ namespace OVR {
//-----------------------------------------------------------------------------
// Returns the pathname of the JSON file containing the stored profiles
-String GetProfilePath(bool create_dir)
+String GetBaseOVRPath(bool create_dir)
{
String path;
#if defined(OVR_OS_WIN32)
-
- PWSTR data_path = NULL;
- SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &data_path);
+
+ TCHAR data_path[MAX_PATH];
+ SHGetFolderPath(0, CSIDL_LOCAL_APPDATA, NULL, 0, data_path);
path = String(data_path);
- CoTaskMemFree(data_path);
path += "/Oculus";
@@ -113,10 +112,15 @@ String GetProfilePath(bool create_dir)
#endif
- path += "/Profiles.json";
return path;
}
+String GetProfilePath(bool create_dir)
+{
+ String path = GetBaseOVRPath(create_dir);
+ path += "/Profiles.json";
+ return path;
+}
//-----------------------------------------------------------------------------
// ***** ProfileManager
@@ -232,22 +236,25 @@ void ProfileManager::LoadCache(ProfileType device)
Ptr<Profile> profile = *CreateProfileObject(profileName, device, &deviceName);
// Read the base profile fields.
- while (item = profileItem->GetNextItem(item), item)
+ if (profile)
{
- if (item->Type != JSON_Object)
+ while (item = profileItem->GetNextItem(item), item)
{
- profile->ParseProperty(item->Name, item->Value);
- }
- else
- { // Search for the matching device to get device specific fields
- if (!deviceFound && OVR_strcmp(item->Name, deviceName) == 0)
+ if (item->Type != JSON_Object)
{
- deviceFound = true;
-
- for (JSON* deviceItem = item->GetFirstItem(); deviceItem;
- deviceItem = item->GetNextItem(deviceItem))
+ profile->ParseProperty(item->Name, item->Value);
+ }
+ else
+ { // Search for the matching device to get device specific fields
+ if (!deviceFound && OVR_strcmp(item->Name, deviceName) == 0)
{
- profile->ParseProperty(deviceItem->Name, deviceItem->Value);
+ deviceFound = true;
+
+ for (JSON* deviceItem = item->GetFirstItem(); deviceItem;
+ deviceItem = item->GetNextItem(deviceItem))
+ {
+ profile->ParseProperty(deviceItem->Name, deviceItem->Value);
+ }
}
}
}