Find LANCommander PowerShell module manifest using search

Probably pretty hacky. Environment.CurrentDirectory doesn't seem to be reliable in dev vs prod. In dev it correctly matches the LANCommander.PlaynitePlugin.dll's location. In prod it is the main directory of Playnite.
net8.0
Pat Hartl 2023-11-17 22:35:17 -06:00
parent 737f2bec84
commit bc30cc911a
1 changed files with 5 additions and 1 deletions

View File

@ -32,7 +32,11 @@ namespace LANCommander.SDK.PowerShell
Process.StartInfo.RedirectStandardOutput = false;
AddArgument("ExecutionPolicy", "Unrestricted");
AddModule(Path.Combine(Environment.CurrentDirectory, "LANCommander.PowerShell.psd1"));
var moduleManifests = Directory.EnumerateFiles(Environment.CurrentDirectory, "LANCommander.PowerShell.psd1", SearchOption.AllDirectories);
if (moduleManifests.Any())
AddModule(moduleManifests.First());
IgnoreWow64Redirection();
}