Skip to content

Commit

Permalink
handle dictionary file replacement (fixes #186)
Browse files Browse the repository at this point in the history
  • Loading branch information
itkach committed Jul 8, 2024
1 parent 7c95f15 commit 3db51b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/itkach/aard2/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,17 @@ synchronized public void onChanged() {
slobber.setSlobs(null);
List<Slob> slobs = new ArrayList<Slob>();
for (SlobDescriptor sd : dictionaries) {
String origSlobId = sd.id;
Slob s = sd.load(getApplicationContext());
if (s != null) {
if (!origSlobId.equals(sd.id)) {
Log.d(TAG, String.format("%s has been replaced, updating dict store %s -> %s", sd.path, origSlobId, sd.id));
//dictionary file has been replaced
//(same file name, different slob uuid)
//need to update store accordingly
dictStore.delete(origSlobId);
dictStore.save(sd);
}
slobs.add(s);
}
}
Expand Down

1 comment on commit 3db51b8

@soshial
Copy link

@soshial soshial commented on 3db51b8 Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: @farfromrefug this is an important fix

Please sign in to comment.