mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Fix for #1574, AccessException when loading plugins
This commit is contained in:
parent
c4205de671
commit
0399b97672
1 changed files with 26 additions and 15 deletions
|
@ -209,25 +209,36 @@ namespace Greenshot.Helpers {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Private helper to find the plugins in the path
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pluginFiles"></param>
|
||||||
|
/// <param name="path"></param>
|
||||||
|
private void findPluginsOnPath(List<string> pluginFiles, String path) {
|
||||||
|
if (Directory.Exists(pafPath)) {
|
||||||
|
try {
|
||||||
|
foreach (string pluginFile in Directory.GetFiles(path, "*.gsp", SearchOption.AllDirectories)) {
|
||||||
|
pluginFiles.Add(pluginFile);
|
||||||
|
}
|
||||||
|
} catch (System.UnauthorizedAccessException) {
|
||||||
|
return;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
LOG.Error("Error loading plugin: ", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load the plugins
|
||||||
|
/// </summary>
|
||||||
public void LoadPlugins() {
|
public void LoadPlugins() {
|
||||||
List<string> pluginFiles = new List<string>();
|
List<string> pluginFiles = new List<string>();
|
||||||
|
|
||||||
if (IniConfig.IsPortable && Directory.Exists(pafPath)) {
|
if (IniConfig.IsPortable) {
|
||||||
foreach(string pluginFile in Directory.GetFiles(pafPath, "*.gsp", SearchOption.AllDirectories)) {
|
findPluginsOnPath(pluginFiles, pafPath);
|
||||||
pluginFiles.Add(pluginFile);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (Directory.Exists(pluginPath)) {
|
findPluginsOnPath(pluginFiles, pluginPath);
|
||||||
foreach(string pluginFile in Directory.GetFiles(pluginPath, "*.gsp", SearchOption.AllDirectories)) {
|
findPluginsOnPath(pluginFiles, applicationPath);
|
||||||
pluginFiles.Add(pluginFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Directory.Exists(applicationPath)) {
|
|
||||||
foreach(string pluginFile in Directory.GetFiles(applicationPath, "*.gsp", SearchOption.AllDirectories)) {
|
|
||||||
pluginFiles.Add(pluginFile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary<string, PluginAttribute> tmpAttributes = new Dictionary<string, PluginAttribute>();
|
Dictionary<string, PluginAttribute> tmpAttributes = new Dictionary<string, PluginAttribute>();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue