Skip to content

Commit 551a6f5

Browse files
committed
Oops, forgot sranipal could be installed in different places
1 parent 18c5e27 commit 551a6f5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

SRanipalExtTrackingModule/SRanipalTrackingInterface.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Microsoft.Extensions.Logging;
22
using System.Diagnostics;
33
using System.Runtime.InteropServices;
4+
using Microsoft.Win32;
45
using ViveSR;
56
using ViveSR.anipal;
67
using ViveSR.anipal.Eye;
@@ -33,8 +34,17 @@ public override (bool eyeSuccess, bool expressionSuccess) Initialize(bool eyeAva
3334
// Look for SRanipal assemblies here. Placeholder for unmanaged assemblies not being embedded in the dll.
3435
var currentDllDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
3536

37+
// Get the directory of the sr_runtime.exe program from our start menu shortcut. This is where the SRanipal dlls are located.
38+
var srInstallDir = (string) Registry.LocalMachine.OpenSubKey(@"Software\VIVE\SRWorks\SRanipal")?.GetValue("ModuleFileName");
39+
40+
if (srInstallDir == null)
41+
{
42+
Logger.LogError("SRanipalExtTrackingModule: SRanipal not installed.");
43+
return (false, false);
44+
}
45+
3646
// Get the currently installed sr_runtime version. If it's above 1.3.6.* then we use ModuleLibs\\New
37-
var srRuntimeVer = FileVersionInfo.GetVersionInfo("C:\\Program Files\\VIVE\\SRanipal\\sr_runtime.exe").FileVersion;
47+
var srRuntimeVer = FileVersionInfo.GetVersionInfo(srInstallDir).FileVersion;
3848

3949
Logger.LogInformation($"SRanipalExtTrackingModule: SRanipal version: {srRuntimeVer}");
4050

0 commit comments

Comments
 (0)