Browse Source

fixed bug causing directories to disappear immediately after renaming to a long name.

Sebastian Stenzel 9 years ago
parent
commit
bb185c3170

+ 11 - 0
main/filesystem-nameshortening/src/main/java/org/cryptomator/filesystem/shortening/ShorteningFile.java

@@ -46,4 +46,15 @@ class ShorteningFile extends DelegatingFile<ShorteningFolder> {
 		return super.openWritable();
 	}
 
+	@Override
+	public void moveTo(File destination) {
+		super.moveTo(destination);
+		if (destination instanceof ShorteningFile) {
+			ShorteningFile dest = (ShorteningFile) destination;
+			if (shortener.isShortened(dest.shortenedName())) {
+				shortener.saveMapping(dest.name(), dest.shortenedName());
+			}
+		}
+	}
+
 }