Implement prototype paths in manifest class

This commit is contained in:
Vasily
2019-03-19 16:10:35 +01:00
committed by username223
parent ac4a124450
commit 1d05ae96f9
2 changed files with 15 additions and 7 deletions
+14 -6
View File
@@ -2,6 +2,7 @@
#include <QStandardPaths> #include <QStandardPaths>
#include <openvr.h> #include <openvr.h>
#include <easylogging++.h> #include <easylogging++.h>
#include "../utils/paths.h"
namespace input namespace input
{ {
@@ -14,16 +15,23 @@ class Manifest
public: public:
Manifest() Manifest()
{ {
QString actionManifestPath = QStandardPaths::locate( const auto actionManifestPath
QStandardPaths::AppDataLocation, = paths::binaryDirectoryFindFile( "action_manifest.json" );
QStringLiteral( "action_manifest.json" ) );
auto error = vr::VRInput()->SetActionManifestPath( if ( !actionManifestPath.has_value() )
actionManifestPath.toStdString().c_str() ); {
LOG( ERROR ) << "Could not find action manifest. Action manifests "
"not initialized.";
return;
}
const auto validManifestPath = actionManifestPath->c_str();
auto error = vr::VRInput()->SetActionManifestPath( validManifestPath );
if ( error != vr::EVRInputError::VRInputError_None ) if ( error != vr::EVRInputError::VRInputError_None )
{ {
LOG( ERROR ) << "Error setting action manifest path: " LOG( ERROR ) << "Error setting action manifest path: "
<< actionManifestPath << ". OpenVR Error: " << error; << validManifestPath << ". OpenVR Error: " << error;
} }
} }
+1 -1
View File
@@ -26,7 +26,7 @@ optional<string> binaryDirectoryFindFile( const string fileName )
if ( path == "" ) if ( path == "" )
{ {
LOG( ERROR ) << "Could not find file '" << fileName LOG( ERROR ) << "Could not find file '" << fileName.c_str()
<< "' in binary directory."; << "' in binary directory.";
return std::nullopt; return std::nullopt;
} }