Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2012-04-30 17:31:12 +0400
committerMike Krüger <mkrueger@xamarin.com>2012-04-30 17:32:04 +0400
commit54ea512fcf653a5c635f0726c3a3190dd929bbea (patch)
treec881f35893357c0a39c60d3c989bb3d151a3804f
parent7a55da710f0bb454d15f30f8fe63b48e8b48aa3f (diff)
[Ide] Fixed build on windows.
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs56
1 files changed, 31 insertions, 25 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
index fecf1e8434..9f913946a6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/TypeSystemService.cs
@@ -354,42 +354,48 @@ namespace MonoDevelop.Ide.TypeSystem
struct CacheDirectoryInfo
{
+ public static readonly CacheDirectoryInfo Empty = new CacheDirectoryInfo ();
+
public string FileName { get; set; }
public string Version { get; set; }
}
static Dictionary<FilePath, CacheDirectoryInfo> cacheDirectoryCache = new Dictionary<FilePath, CacheDirectoryInfo> ();
+
static bool CheckCacheDirectoryIsCorrect (FilePath filename, FilePath candidate, out string result)
{
- result = null;
-
- CacheDirectoryInfo info;
- if (!cacheDirectoryCache.TryGetValue (candidate, out info)) {
- var dataPath = candidate.Combine ("data.xml");
-
- try {
- if (!File.Exists (dataPath))
- return false;
- using (var reader = XmlReader.Create (dataPath)) {
- while (reader.Read ()) {
- if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "File") {
- info.Version = reader.GetAttribute ("version");
- info.FileName = reader.GetAttribute ("name");
+ lock (cacheDirectoryCache) {
+ CacheDirectoryInfo info;
+ if (!cacheDirectoryCache.TryGetValue (candidate, out info)) {
+ var dataPath = candidate.Combine ("data.xml");
+
+ try {
+ if (!File.Exists (dataPath)) {
+ cacheDirectoryCache [candidate] = CacheDirectoryInfo.Empty;
+ result = null;
+ return false;
+ }
+ using (var reader = XmlReader.Create (dataPath)) {
+ while (reader.Read ()) {
+ if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "File") {
+ info.Version = reader.GetAttribute ("version");
+ info.FileName = reader.GetAttribute ("name");
+ }
}
}
+ cacheDirectoryCache [candidate] = info;
+ } catch (Exception e) {
+ LoggingService.LogError ("Error while reading derived data file " + dataPath, e);
}
- cacheDirectoryCache [candidate] = info;
- } catch (Exception e) {
- LoggingService.LogError ("Error while reading derived data file " + dataPath, e);
}
+
+ if (info.Version == CurrentVersion && info.FileName == filename) {
+ result = candidate;
+ return true;
+ }
+
+ result = null;
+ return false;
}
-
- if (info.Version == CurrentVersion && info.FileName == filename) {
- result = candidate;
- return true;
- }
-
- result = null;
- return false;
}
static string GetName (string baseName, int i)