mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
BUG-2114 / FEATURE-998 consolidated the logic to make the behavior equal for all entry points.
This commit is contained in:
parent
69deb19b1f
commit
5bdfcd5306
2 changed files with 35 additions and 58 deletions
|
@ -15,11 +15,11 @@ namespace GreenshotPlugin.Core
|
|||
/// If the path is a file, the explorer is opened with the directory and the file is selected.
|
||||
/// </summary>
|
||||
/// <param name="path">Path to file or directory</param>
|
||||
public static void OpenInExplorer(string path)
|
||||
public static bool OpenInExplorer(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -28,6 +28,7 @@ namespace GreenshotPlugin.Core
|
|||
{
|
||||
using (Process.Start(path))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Check if path is a file
|
||||
|
@ -37,6 +38,7 @@ namespace GreenshotPlugin.Core
|
|||
using (var explorer = Process.Start("explorer.exe", $"/select,\"{path}\""))
|
||||
{
|
||||
explorer?.WaitForInputIdle(500);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +48,7 @@ namespace GreenshotPlugin.Core
|
|||
ex.Data.Add("path", path);
|
||||
throw;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue