X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/ef55196806a13b932f57bb9d8af971afd18ecdf1..24ab58cc1405344dedbf67eaf5f4314bdae747eb:/src/main/java/org/asamk/signal/Manager.java diff --git a/src/main/java/org/asamk/signal/Manager.java b/src/main/java/org/asamk/signal/Manager.java index 49d22db0..dc979930 100644 --- a/src/main/java/org/asamk/signal/Manager.java +++ b/src/main/java/org/asamk/signal/Manager.java @@ -35,7 +35,6 @@ import org.asamk.signal.storage.protocol.JsonIdentityKeyStore; import org.asamk.signal.storage.protocol.JsonSignalProtocolStore; import org.asamk.signal.storage.threads.JsonThreadStore; import org.asamk.signal.storage.threads.ThreadInfo; -import org.asamk.signal.util.Base64; import org.asamk.signal.util.Util; import org.whispersystems.libsignal.*; import org.whispersystems.libsignal.ecc.Curve; @@ -64,6 +63,7 @@ import org.whispersystems.signalservice.api.util.InvalidNumberException; import org.whispersystems.signalservice.api.util.PhoneNumberFormatter; import org.whispersystems.signalservice.internal.push.SignalServiceProtos; import org.whispersystems.signalservice.internal.push.SignalServiceUrl; +import org.whispersystems.signalservice.internal.util.Base64; import java.io.*; import java.net.URI; @@ -1116,6 +1116,8 @@ class Manager implements Signal { System.err.println("Failed to delete cached message file “" + fileEntry + "”: " + e.getMessage()); } } + // Try to delete directory if empty + dir.delete(); } } @@ -1169,6 +1171,8 @@ class Manager implements Signal { try { cacheFile = getMessageCacheFile(envelope.getSource(), now, envelope.getTimestamp()); Files.delete(cacheFile.toPath()); + // Try to delete directory if empty + new File(getMessageCachePath()).delete(); } catch (IOException e) { System.err.println("Failed to delete cached message file “" + cacheFile + "”: " + e.getMessage()); }