From cdf7cbfeb772ef39e181b924d4d7b7b9ca84d6bb Mon Sep 17 00:00:00 2001 From: Dennis Reimann Date: Mon, 20 Jan 2025 18:59:51 +0100 Subject: [PATCH] Plugins: Convert relative to absolute path when loading a plugin Avoids having to provide absolute paths, which differ across machines. We use this for the app to [reference the app plugin](https://github.com/btcpayserver/btcpayserver/blob/mobile-working-branch/BTCPayServer/Properties/launchSettings.json#L7) in the launch settings. --- BTCPayServer/Plugins/PluginManager.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/Plugins/PluginManager.cs b/BTCPayServer/Plugins/PluginManager.cs index a84a84102..bd5d270c9 100644 --- a/BTCPayServer/Plugins/PluginManager.cs +++ b/BTCPayServer/Plugins/PluginManager.cs @@ -125,10 +125,19 @@ namespace BTCPayServer.Plugins { // Formatted either as "::" or "" var idx = plugin.IndexOf("::"); + var filePath = plugin; if (idx != -1) - pluginsToLoad.Add((plugin[0..idx], plugin[(idx + 1)..])); + { + filePath = plugin[(idx + 1)..]; + filePath = Path.GetFullPath(filePath); + pluginsToLoad.Add((plugin[0..idx], filePath)); + } else - pluginsToLoad.Add((Path.GetFileNameWithoutExtension(plugin), plugin)); + { + filePath = Path.GetFullPath(filePath); + + pluginsToLoad.Add((Path.GetFileNameWithoutExtension(plugin), filePath)); + } } #endif