diff --git a/src/LfMergeBridge/LanguageForgeSendReceiveActionHandler.cs b/src/LfMergeBridge/LanguageForgeSendReceiveActionHandler.cs index 62df6993..346a7684 100644 --- a/src/LfMergeBridge/LanguageForgeSendReceiveActionHandler.cs +++ b/src/LfMergeBridge/LanguageForgeSendReceiveActionHandler.cs @@ -30,15 +30,35 @@ namespace LfMergeBridge [Export(typeof(IBridgeActionTypeHandler))] internal sealed class LanguageForgeSendReceiveActionHandler : IBridgeActionTypeHandler { - private const string FwDataExe = "FixFwData.exe"; + private const string FwData = "FixFwData"; private const string syncBase = "Sync"; + private static string FindFwData() + { + // Try current working directory first + var cwd = Directory.GetCurrentDirectory(); + var withExe = Path.Combine(cwd, FwData + ".exe"); + if (File.Exists(withExe)) return withExe; + var withoutExe = Path.Combine(cwd, FwData); + if (File.Exists(withoutExe)) return withoutExe; + + // Then try loction of LfMergeBridge.dll, as FixFwData is probably installed alongside as a sister file + var assembly = Assembly.GetExecutingAssembly(); + var dir = Directory.GetParent(assembly.Location).FullName; + withExe = Path.Combine(dir, FwData + ".exe"); + if (File.Exists(withExe)) return withExe; + withoutExe = Path.Combine(dir, FwData); + if (File.Exists(withoutExe)) return withoutExe; + + return null; + } + /// /// Do a Send/Receive with the matching Language Depot project for the given Language Forge project's repository. /// /// This handler will *not* reset the workspace to another branch or long hash, /// since doing so would prevent any new changes in the fwdata file from being processed. - /// + /// /// If LF needs to sync with another commit (via its long hash), /// LF *must* first use the action handler "LanguageForgeUpdateToLongHashActionHandler", /// which will reset the workspace, and then LF can write new changes to the fwdata file, @@ -56,10 +76,10 @@ void IBridgeActionTypeHandler.StartWorking(IProgress progress, Dictionary