Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect OS language at NativeDesktop#getDefaultFileChooserDirectory #9837

Merged
merged 14 commits into from
May 18, 2023
4 changes: 2 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 @@ -21,7 +21,6 @@
import org.jabref.gui.util.StreamGobbler;
import org.jabref.logic.l10n.Localization;

import com.microsoft.applicationinsights.core.dependencies.apachecommons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -182,7 +181,8 @@ public Path getDefaultFileChooserDirectory() {
// See https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ for details
try {
Process process = new ProcessBuilder("xdg-user-dirs", "DOCUMENTS").start();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the script is called xdg-user-dir without the s. Its a mess i know. The ""Toolkit"" is called -dirs but the script that you actually run is called -dir

Copy link

@dermalikmann dermalikmann May 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it anyways by copying the script with the modified name into my path, and it successfully puts /home/<USER>/Dokumente into the "Main file directory" field.

List<String> strings = IOUtils.readLines(process.getInputStream(), StandardCharsets.UTF_8);
List<String> strings = new BufferedReader(new InputStreamReader(process.getInputStream(), StandardCharsets.UTF_8))
.lines().toList();
String documentsPath = strings.get(0);
koppor marked this conversation as resolved.
Show resolved Hide resolved
LOGGER.debug("Got documents path {}", documentsPath);
return Path.of(documentsPath);
Expand Down