mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[PTRun]Add logs to check Web Browser detection (#18831)
* [PTRun]Add logs to check Web Browser detection * Use proper initial value * Add punctuation to the end of the log message
This commit is contained in:
@@ -150,7 +150,7 @@ namespace Wox.Infrastructure
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(pattern))
|
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))
|
else if (pattern.Contains("%1", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ namespace Wox.Plugin.Common
|
|||||||
public static class DefaultBrowserInfo
|
public static class DefaultBrowserInfo
|
||||||
{
|
{
|
||||||
private static readonly object _updateLock = new object();
|
private static readonly object _updateLock = new object();
|
||||||
private static int _lastUpdateTickCount = -1;
|
|
||||||
|
|
||||||
/// <summary>Gets the path to the MS Edge browser executable.</summary>
|
/// <summary>Gets the path to the MS Edge browser executable.</summary>
|
||||||
public static string MSEdgePath =>
|
public static string MSEdgePath =>
|
||||||
@@ -41,7 +40,11 @@ namespace Wox.Plugin.Common
|
|||||||
|
|
||||||
public static bool IsDefaultBrowserSet { get => !string.IsNullOrEmpty(Path); }
|
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;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates only if at least more than 300ms has passed since the last update, to avoid multiple calls to <see cref="Update"/>.
|
/// Updates only if at least more than 300ms has passed since the last update, to avoid multiple calls to <see cref="Update"/>.
|
||||||
@@ -49,8 +52,8 @@ namespace Wox.Plugin.Common
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static void UpdateIfTimePassed()
|
public static void UpdateIfTimePassed()
|
||||||
{
|
{
|
||||||
int curTickCount = Environment.TickCount;
|
long curTickCount = Environment.TickCount64;
|
||||||
if (curTickCount - _lastUpdateTickCount > UpdateTimeout)
|
if (curTickCount - _lastUpdateTickCount >= UpdateTimeout)
|
||||||
{
|
{
|
||||||
_lastUpdateTickCount = curTickCount;
|
_lastUpdateTickCount = curTickCount;
|
||||||
Update();
|
Update();
|
||||||
@@ -65,6 +68,12 @@ namespace Wox.Plugin.Common
|
|||||||
{
|
{
|
||||||
lock (_updateLock)
|
lock (_updateLock)
|
||||||
{
|
{
|
||||||
|
if (!haveIRanUpdateOnce)
|
||||||
|
{
|
||||||
|
Log.Warn("I've tried updating the chosen Web Browser info at least once.", typeof(DefaultBrowserInfo));
|
||||||
|
haveIRanUpdateOnce = true;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string progId = GetRegistryValue(
|
string progId = GetRegistryValue(
|
||||||
|
|||||||
Reference in New Issue
Block a user