| 27 | } |
| 28 | |
| 29 | bool COculusOauthTokenController::Init() |
| 30 | { |
| 31 | //cd up from %APPDATA%/Roaming/APPNAME to %APPDATA%/Roaming |
| 32 | m_roamingAppDataPath.cdUp(); |
| 33 | QString oculusOfflineDb = m_roamingAppDataPath.filePath("Oculus/Sessions/_oaf/data.sqlite"); |
| 34 | QString tempOculusOfflineDB = m_roamingAppDataPath.filePath("Oculus/Sessions/_oaf/revive_data.sqlite"); |
| 35 | |
| 36 | //Clean up saved credentials from previous versions as they're no longer needed |
| 37 | WindowsServices::DeleteCredentials(); |
| 38 | |
| 39 | if (!QFile::exists(oculusOfflineDb)) |
| 40 | return false; |
| 41 | |
| 42 | //Check for temp db that somehow missed cleanup |
| 43 | if (QFile::exists(tempOculusOfflineDB)) |
| 44 | QFile::remove(tempOculusOfflineDB); |
| 45 | |
| 46 | //The SQLite DB is locked by the oculus service, so we need to make a copy |
| 47 | QFile::copy(oculusOfflineDb, tempOculusOfflineDB); |
| 48 | m_sqliteDb.setDatabaseName(tempOculusOfflineDB); |
| 49 | |
| 50 | if(!m_sqliteDb.open() || !LoadToken()) |
| 51 | { |
| 52 | m_sqliteDb.close(); |
| 53 | QFile::remove(tempOculusOfflineDB); |
| 54 | CTrayIconController::SharedInstance()->ShowInformation(TrayInfo_OculusAccessTokenNotFound); |
| 55 | return false; |
| 56 | } |
| 57 | |
| 58 | m_sqliteDb.close(); |
| 59 | QFile::remove(tempOculusOfflineDB); |
| 60 | return true; |
| 61 | } |
| 62 | |
| 63 | bool COculusOauthTokenController::LoadToken() |
| 64 | { |
nothing calls this directly
no test coverage detected