diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2015-06-17 18:18:34 +0300 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2015-06-17 18:18:34 +0300 |
commit | e22febe3c4b0f448ec0aef90c63d92cdae4dcb4e (patch) | |
tree | 12e20212427f8dd9b05698f879aba7d19bd13df0 /Mono.Addins/Mono.Addins.Database | |
parent | fbe9f412705aa2f4adb0aafc56fcb15671f36fbe (diff) |
Fix issue when getting the domain of a folder
Sometimes the folder is stored with a trailing slash. This case
has to be checked when getting the domain of a folder.
Diffstat (limited to 'Mono.Addins/Mono.Addins.Database')
-rw-r--r-- | Mono.Addins/Mono.Addins.Database/AddinDatabase.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs index 8708a21..3201c0e 100644 --- a/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs +++ b/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs @@ -1470,11 +1470,17 @@ namespace Mono.Addins.Database public string GetFolderDomain (IProgressStatus progressStatus, string path) { AddinScanFolderInfo folderInfo; - if (GetFolderInfoForPath (progressStatus, path, out folderInfo) && folderInfo != null && !folderInfo.SharedFolder) + + if (GetFolderInfoForPath (progressStatus, path, out folderInfo) && folderInfo == null) { + if (path.Length > 0 && path [path.Length - 1] != Path.DirectorySeparatorChar) + // Try again by appending a directory separator at the end. Some directories are registered like this. + GetFolderInfoForPath (progressStatus, path + Path.DirectorySeparatorChar, out folderInfo); + else if (path.Length > 0 && path [path.Length - 1] == Path.DirectorySeparatorChar) + // Try again by removing the directory separator at the end. Some directories are registered like this. + GetFolderInfoForPath (progressStatus, path.TrimEnd (Path.DirectorySeparatorChar), out folderInfo); + } + if (folderInfo != null && !string.IsNullOrEmpty (folderInfo.Domain)) return folderInfo.Domain; - else if (path.Length > 0 && path [path.Length - 1] != Path.DirectorySeparatorChar) - // Try again by appending a directory separator at the end. Some directories are registered like this. - return GetFolderDomain (progressStatus, path + Path.DirectorySeparatorChar); else return UnknownDomain; } |