Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue where it was no longer possible to connect to a shared mysql database due to an exception [#9761](https://github.com/JabRef/jabref/issues/9761)
- We fixed the citation key generation for (`[authors]`, `[authshort]`, `[authorsAlpha]`, `authIniN`, `authEtAl`, `auth.etal`)[https://docs.jabref.org/setup/citationkeypatterns#special-field-markers] to handle `and others` properly. [koppor#626](https://github.com/koppor/jabref/issues/626)
- We fixed the Save/save as file type shows BIBTEX_DB instead of "Bibtex library" [#9372](https://github.com/JabRef/jabref/issues/9372)
- We fixed the default main file directory for non-English Linux and macOS users. [#8010](https://github.com/JabRef/jabref/issues/8010)

### Removed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Swing's FileChooser implemented a very decent directory determination algorithm.
It thereby uses `sun.awt.shell.ShellFolder`.

* Good, because provides best results on most platforms.
* Good, because also supports localization of the folder name. E.g., `~/Dokumente` in Germany.
* Bad, because introduces a dependency on Swing and thereby contradicts the second decision driver.
* Bad, because GraalVM's support Swing is experimental

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/jabref/gui/desktop/os/DefaultDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,4 @@ public String detectProgramPath(String programName, String directoryName) {
public Path getApplicationDirectory() {
return getUserDirectory();
}

@Override
public Path getDefaultFileChooserDirectory() {
return Path.of(System.getProperty("user.home"));
}
}
7 changes: 5 additions & 2 deletions src/main/java/org/jabref/gui/desktop/os/Linux.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import java.util.Objects;
import java.util.Optional;

import javax.swing.filechooser.FileSystemView;

import org.jabref.architecture.AllowedToUseAwt;
import org.jabref.architecture.AllowedToUseSwing;
import org.jabref.gui.DialogService;
import org.jabref.gui.Globals;
import org.jabref.gui.JabRefExecutorService;
Expand All @@ -24,6 +27,7 @@
import org.slf4j.LoggerFactory;

@AllowedToUseAwt("Requires AWT to open a file with the native method")
@AllowedToUseSwing("Uses getFileSystemView to get the default documents directory")
public class Linux implements NativeDesktop {

private static final Logger LOGGER = LoggerFactory.getLogger(Linux.class);
Expand Down Expand Up @@ -173,7 +177,6 @@ public Path getApplicationDirectory() {
public Path getDefaultFileChooserDirectory() {
return Path.of(Objects.requireNonNullElse(
System.getenv("XDG_DOCUMENTS_DIR"),
System.getProperty("user.home") + "/Documents")
);
FileSystemView.getFileSystemView().getDefaultDirectory().getPath()));
}
}
8 changes: 7 additions & 1 deletion src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import java.io.IOException;
import java.nio.file.Path;

import javax.swing.filechooser.FileSystemView;

import org.jabref.architecture.AllowedToUseSwing;
import org.jabref.gui.DialogService;

@AllowedToUseSwing("Uses getFileSystemView to get the default documents directory")
public interface NativeDesktop {

void openFile(String filePath, String fileType) throws IOException;
Expand Down Expand Up @@ -35,7 +39,9 @@ public interface NativeDesktop {
*
* @return The path to the directory
*/
Path getDefaultFileChooserDirectory();
default Path getDefaultFileChooserDirectory() {
return Path.of(FileSystemView.getFileSystemView().getDefaultDirectory().getPath());
}

/**
* Returns the path to the system's user directory.
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/org/jabref/gui/desktop/os/OSX.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,4 @@ public String detectProgramPath(String programName, String directoryName) {
public Path getApplicationDirectory() {
return Path.of("/Applications");
}

@Override
public Path getDefaultFileChooserDirectory() {
return Path.of(System.getProperty("user.home") + "/Documents");
}
}