diff --git a/src/modules/launcher/Wox.Infrastructure/Helper.cs b/src/modules/launcher/Wox.Infrastructure/Helper.cs index 1f84985adb..5634b49fa2 100644 --- a/src/modules/launcher/Wox.Infrastructure/Helper.cs +++ b/src/modules/launcher/Wox.Infrastructure/Helper.cs @@ -150,7 +150,7 @@ namespace Wox.Infrastructure { if (string.IsNullOrEmpty(pattern)) { - Log.Warn("Trying to run OpenCommandInShell with an empty pattern. The default browser definition might have issues.", typeof(Helper)); + Log.Warn($"Trying to run OpenCommandInShell with an empty pattern. The default browser definition might have issues. Path: '${path ?? string.Empty}' ; Arguments: '${arguments ?? string.Empty}' ; Working Directory: '${workingDir ?? string.Empty}'", typeof(Helper)); } else if (pattern.Contains("%1", StringComparison.Ordinal)) { diff --git a/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs b/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs index d19f78f94e..52d1563877 100644 --- a/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs +++ b/src/modules/launcher/Wox.Plugin/Common/DefaultBrowserInfo.cs @@ -15,7 +15,6 @@ namespace Wox.Plugin.Common public static class DefaultBrowserInfo { private static readonly object _updateLock = new object(); - private static int _lastUpdateTickCount = -1; /// Gets the path to the MS Edge browser executable. public static string MSEdgePath => @@ -41,7 +40,11 @@ namespace Wox.Plugin.Common public static bool IsDefaultBrowserSet { get => !string.IsNullOrEmpty(Path); } - public const int UpdateTimeout = 300; + public const long UpdateTimeout = 300; + + private static long _lastUpdateTickCount = -UpdateTimeout; + + private static bool haveIRanUpdateOnce; /// /// Updates only if at least more than 300ms has passed since the last update, to avoid multiple calls to . @@ -49,8 +52,8 @@ namespace Wox.Plugin.Common /// public static void UpdateIfTimePassed() { - int curTickCount = Environment.TickCount; - if (curTickCount - _lastUpdateTickCount > UpdateTimeout) + long curTickCount = Environment.TickCount64; + if (curTickCount - _lastUpdateTickCount >= UpdateTimeout) { _lastUpdateTickCount = curTickCount; Update(); @@ -65,6 +68,12 @@ namespace Wox.Plugin.Common { lock (_updateLock) { + if (!haveIRanUpdateOnce) + { + Log.Warn("I've tried updating the chosen Web Browser info at least once.", typeof(DefaultBrowserInfo)); + haveIRanUpdateOnce = true; + } + try { string progId = GetRegistryValue(