Skip to content

Commit 3db51b8

Browse files
committed
handle dictionary file replacement (fixes #186)
1 parent 7c95f15 commit 3db51b8

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/itkach/aard2/Application.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,17 @@ synchronized public void onChanged() {
142142
slobber.setSlobs(null);
143143
List<Slob> slobs = new ArrayList<Slob>();
144144
for (SlobDescriptor sd : dictionaries) {
145+
String origSlobId = sd.id;
145146
Slob s = sd.load(getApplicationContext());
146147
if (s != null) {
148+
if (!origSlobId.equals(sd.id)) {
149+
Log.d(TAG, String.format("%s has been replaced, updating dict store %s -> %s", sd.path, origSlobId, sd.id));
150+
//dictionary file has been replaced
151+
//(same file name, different slob uuid)
152+
//need to update store accordingly
153+
dictStore.delete(origSlobId);
154+
dictStore.save(sd);
155+
}
147156
slobs.add(s);
148157
}
149158
}

0 commit comments

Comments
 (0)