diff --git a/CHANGELOG.md b/CHANGELOG.md index f79e5a16120..e3b8b3ccb97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve - `log.txt` now contains debug messages. Debugging needs to be enabled explicitly. [#9678](https://github.com/JabRef/jabref/pull/9678) - `log.txt` does not contain entries for non-found files during PDF indexing. [#9678](https://github.com/JabRef/jabref/pull/9678) - We improved the Medline importer to correctly import ISO dates for `revised`. [#9536](https://github.com/JabRef/jabref/issues/9536) +- To avoid cluttering of the directory, We always delete the `.sav` file upon successful write. [#9675](https://github.com/JabRef/jabref/pull/9675) diff --git a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java index 5694d79b803..58f98365592 100644 --- a/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java +++ b/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java @@ -62,6 +62,7 @@ public class AtomicFileOutputStream extends FilterOutputStream { private final Path temporaryFile; private final FileLock temporaryFileLock; + /** * A backup of the target file (if it exists), created when the stream is closed */ @@ -75,7 +76,7 @@ public class AtomicFileOutputStream extends FilterOutputStream { * Creates a new output stream to write to or replace the file at the specified path. * * @param path the path of the file to write to or replace - * @param keepBackup whether to keep the backup file after a successful write process + * @param keepBackup whether to keep the backup file (.sav) after a successful write process */ public AtomicFileOutputStream(Path path, boolean keepBackup) throws IOException { // Files.newOutputStream(getPathOfTemporaryFile(path)) leads to a "sun.nio.ch.ChannelOutputStream", which does not offer "lock" @@ -84,7 +85,7 @@ public AtomicFileOutputStream(Path path, boolean keepBackup) throws IOException /** * Creates a new output stream to write to or replace the file at the specified path. - * The backup file is deleted when write was successful. + * The backup file (.sav) is deleted when write was successful. * * @param path the path of the file to write to or replace */ @@ -238,7 +239,7 @@ public void close() throws IOException { } if (!keepBackup) { - // Remove backup file + // Remove backup file for saving Files.deleteIfExists(backupFile); } } finally { diff --git a/src/main/java/org/jabref/logic/exporter/SavePreferences.java b/src/main/java/org/jabref/logic/exporter/SavePreferences.java index 1165d3338c9..a566c0c3449 100644 --- a/src/main/java/org/jabref/logic/exporter/SavePreferences.java +++ b/src/main/java/org/jabref/logic/exporter/SavePreferences.java @@ -49,7 +49,7 @@ public SavePreferences(Boolean saveInOriginalOrder, this(saveInOriginalOrder, saveOrder, - true, + false, saveType, takeMetadataSaveOrderInAccount, reformatFile,