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

github.com/xamarin/macdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremie Laval <jeremie.laval@gmail.com>2012-02-16 15:28:58 +0400
committerJeremie Laval <jeremie.laval@gmail.com>2012-02-16 15:28:58 +0400
commitc60d1145dd2f0b141336908c6a2ff3321a0a61d7 (patch)
treea0c781c63558a9bd219e3fc5307a3a15e82232f0 /IndexUpdateManager.cs
parent74c7d753b4b4cca369a81fdf2a38936f3975c4ff (diff)
[macdoc] Force indexes recreations when the underlying fs elements don't exist
Diffstat (limited to 'IndexUpdateManager.cs')
-rw-r--r--IndexUpdateManager.cs20
1 files changed, 14 insertions, 6 deletions
diff --git a/IndexUpdateManager.cs b/IndexUpdateManager.cs
index cef2fc4..33cc7e3 100644
--- a/IndexUpdateManager.cs
+++ b/IndexUpdateManager.cs
@@ -30,13 +30,21 @@ namespace macdoc
Dictionary<string, string> md5sums = null;
var path = Path.Combine (baseUserDir, "index_freshness");
- if (File.Exists (path)) {
- try {
- md5sums = DeserializeDictionary (path);
- } catch {}
- }
- if (md5sums == null)
+ // Two cases can trigger index creation/re-creation:
+ // 1- there is no search_index folder or no monodoc.index file (i.e. GetIndex or GetSearchIndex returns null)
+ // 2- one of the doc source we use is stale
+ if (AppDelegate.Root.GetIndex () == null || AppDelegate.Root.GetSearchIndex () == null) {
+ // force stale state
md5sums = new Dictionary<string, string> ();
+ } else {
+ if (File.Exists (path)) {
+ try {
+ md5sums = DeserializeDictionary (path);
+ } catch {}
+ }
+ if (md5sums == null)
+ md5sums = new Dictionary<string, string> ();
+ }
bool isFresh = true;
HashAlgorithm hasher = MD5.Create ();