mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Fix for stability issues with the ExternalCommandPlugin.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2602 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
05b69667cf
commit
2a8e2475d8
2 changed files with 15 additions and 7 deletions
|
@ -122,10 +122,14 @@ namespace ExternalCommand {
|
||||||
itemPlugInRoot = new ToolStripMenuItem();
|
itemPlugInRoot = new ToolStripMenuItem();
|
||||||
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
itemPlugInRoot.Text = Language.GetString("externalcommand", "contextmenu_configure");
|
||||||
itemPlugInRoot.Tag = host;
|
itemPlugInRoot.Tag = host;
|
||||||
|
try {
|
||||||
string exePath = PluginUtils.GetExePath("cmd.exe");
|
string exePath = PluginUtils.GetExePath("cmd.exe");
|
||||||
if (exePath != null && File.Exists(exePath)) {
|
if (exePath != null && File.Exists(exePath)) {
|
||||||
itemPlugInRoot.Image = PluginUtils.GetExeIcon(exePath, 0);
|
itemPlugInRoot.Image = PluginUtils.GetExeIcon(exePath, 0);
|
||||||
}
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.Warn("Couldn't get the cmd.exe image", ex);
|
||||||
|
}
|
||||||
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick);
|
||||||
|
|
||||||
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
PluginUtils.AddToContextMenu(host, itemPlugInRoot);
|
||||||
|
|
|
@ -53,11 +53,15 @@ namespace GreenshotPlugin.Core {
|
||||||
return (string)key.GetValue("");
|
return (string)key.GetValue("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (string test in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(';')) {
|
foreach (string pathEntry in (Environment.GetEnvironmentVariable("PATH") ?? "").Split(';')) {
|
||||||
string path = test.Trim();
|
try {
|
||||||
|
string path = pathEntry.Trim();
|
||||||
if (!String.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, exeName))) {
|
if (!String.IsNullOrEmpty(path) && File.Exists(path = Path.Combine(path, exeName))) {
|
||||||
return Path.GetFullPath(path);
|
return Path.GetFullPath(path);
|
||||||
}
|
}
|
||||||
|
} catch (Exception) {
|
||||||
|
LOG.WarnFormat("Problem with path entry '{0}'.", pathEntry);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue