Skip to content

Commit

Permalink
ReviveOverlay: Copy over input manifests at runtime.
Browse files Browse the repository at this point in the history
This also moves all application data to the non-roaming data folder.
  • Loading branch information
CrossVR committed Nov 25, 2018
1 parent b0d756f commit ee8621e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Installer/Revive.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ install:
File /r "${BASE_DIR}\*.jpg"
File /r "${BASE_DIR}\Qt*"

SetOutPath "$APPDATA\Revive\Input"
SetOutPath "$INSTDIR\Input"

; Application data
File /r "${SRC_DIR}\Input\*.json"
Expand Down
2 changes: 1 addition & 1 deletion Revive/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ InputManager::~InputManager()
void InputManager::LoadActionManifest()
{
CComHeapPtr<wchar_t> folder;
HRESULT hr = SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_DEFAULT, NULL, &folder);
HRESULT hr = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, NULL, &folder);

if (SUCCEEDED(hr))
{
Expand Down
2 changes: 1 addition & 1 deletion ReviveInjector/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int wmain(int argc, wchar_t *argv[]) {
}

WCHAR LogPath[MAX_PATH];
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, LogPath)))
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, LogPath)))
{
wcsncat(LogPath, L"\\Revive", MAX_PATH);

Expand Down
25 changes: 17 additions & 8 deletions ReviveOverlay/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,10 @@ int main(int argc, char *argv[])
QApplication a(argc, argv);

// Open the log file and install our handler.
QString logPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
logPath.append("/Revive");
QString logPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Revive/";
if (QDir().mkpath(logPath)) {
g_LogFile = new QFile(logPath + "/ReviveOverlay.txt");
g_LogFile = new QFile(logPath + "ReviveOverlay.txt");
g_LogFile->open(QIODevice::WriteOnly | QIODevice::Truncate);

// Remove obsolete log files
QDir logDir(logPath);
logDir.remove("ReviveOverlay.log");
logDir.remove("ReviveInjector.log");
}
qInstallMessageHandler(myMessageOutput);

Expand All @@ -70,6 +64,21 @@ int main(int argc, char *argv[])
return 0;
}

// Check if we need to copy over input files
QString inputPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/Revive/Input/";
if (!QDir().exists(inputPath) && QDir().mkpath(inputPath))
{
QDir inputDir(QCoreApplication::applicationDirPath() + "/Input");
if (inputDir.exists())
{
QStringList names = inputDir.entryList(QStringList("*.json"));
QStringList files;
for (QString file : names)
files.append(inputDir.path() + "/" + file);
WindowsServices::CopyFiles(files, inputPath, names);
}
}

if (COpenVROverlayController::SharedInstance()->Init())
{
// If the dashboard was successfully created keep running in the background
Expand Down

0 comments on commit ee8621e

Please sign in to comment.