From 3db51b8bf93492b61a4c4ba78fa8cfdf09640a1c Mon Sep 17 00:00:00 2001 From: Igor Tkach Date: Mon, 8 Jul 2024 12:33:41 -0400 Subject: [PATCH] handle dictionary file replacement (fixes #186) --- src/itkach/aard2/Application.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/itkach/aard2/Application.java b/src/itkach/aard2/Application.java index e6dc77f3..138ce3c8 100644 --- a/src/itkach/aard2/Application.java +++ b/src/itkach/aard2/Application.java @@ -142,8 +142,17 @@ synchronized public void onChanged() { slobber.setSlobs(null); List slobs = new ArrayList(); 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); } }