aboutsummaryrefslogtreecommitdiffstats
path: root/LibOVR/Src/OVR_Profile.cpp
diff options
context:
space:
mode:
authorBrad Davis <[email protected]>2013-08-16 12:01:23 -0700
committerBrad Davis <[email protected]>2013-08-16 12:01:23 -0700
commite384cffd7245d1141f9ca81633ab62b07b8907f3 (patch)
treec5e4debbbe6079ff14b7862cde49bf3b916ffb62 /LibOVR/Src/OVR_Profile.cpp
parent20cfcf9dc9485002f05cf50d74ab45375cf0db59 (diff)
parentf29e505a7df820e1376d97b41515bdc89d472499 (diff)
Merge branch 'master' into stable
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);
+ }
}
}
}