From bc30cc911aebda38eba0097671a96b71773e2ec7 Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Fri, 17 Nov 2023 22:35:17 -0600 Subject: [PATCH] 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. --- LANCommander.SDK/PowerShell/PowerShellScript.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/LANCommander.SDK/PowerShell/PowerShellScript.cs b/LANCommander.SDK/PowerShell/PowerShellScript.cs index fbf8256..a9ca191 100644 --- a/LANCommander.SDK/PowerShell/PowerShellScript.cs +++ b/LANCommander.SDK/PowerShell/PowerShellScript.cs @@ -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(); }