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

Conversation

koppor
Copy link
Member

@koppor koppor commented May 3, 2023

Fixes #8010 - especially #8010 (comment)

In Germany, the default "documents" folder is ~/Dokumente. Either we mirror all translations in JabRef - or we use FileSystemView.getFileSystemView().getDefaultDirectory().getPath(). (Source: https://stackoverflow.com/a/32914568/873282)


Follow-up to #9835: This PR is now using a branch in JabRef's main repo so that a) there are builds and b) other devs can easily update the code, too.

Compulsory checks

Preview Give feedback

@Siedlerchr
Copy link
Member

Siedlerchr commented May 3, 2023

Tracked down the implementation:
There is only a shellFolder implementation for windows
FileSystemView etc.. returns

    File f = (File)ShellFolder.get("fileChooserDefaultFolder");

https://github.com/openjdk/jdk/blob/fc76687c2fac39fcbf706c419bfa170b8efa5747/src/java.desktop/share/classes/sun/awt/shell/ShellFolderManager.java#L68-L76

@koppor
Copy link
Member Author

koppor commented May 7, 2023

This should be tested by someone on Linux. I also enabled the debugger, so please check log.txt or the Log window in JabRef.

// Make use of xdg-user-dirs
// 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.

@koppor koppor marked this pull request as ready for review May 12, 2023 07:56
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label May 12, 2023
@koppor koppor requested a review from calixtus May 13, 2023 07:26
Siedlerchr
Siedlerchr previously approved these changes May 18, 2023
* upstream/main: (101 commits)
  Fixed tests by reverting development artifact
  Fixed checkstyle
  Fixed test
  remove empty lines
  move to entry editor prefs
  Reduced use of Globals for fileUpdateMonitor, removed unused themeManager vars
  reformulate
  Update src/main/java/org/jabref/logic/importer/fileformat/BibtexParser.java
  fix checkstyle
  Modernize tests at BibtexParserTest
  Removed ImportFormatReader from Globals at all
  Fixes some JavaDoc errors
  Add newline
  Really fix order
  Fix CHANGELOG.md order
  Fix checkstyle
  Update CHANGELOG.md
  move to entry editor editor tab
  add javadoc
  checkstyle
  ...

# Conflicts:
#	CHANGELOG.md
#	src/main/java/org/jabref/gui/desktop/JabRefDesktop.java
@Siedlerchr Siedlerchr merged commit 1f930c3 into main May 18, 2023
@Siedlerchr Siedlerchr deleted the fix-8010 branch May 18, 2023 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: external-files status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Respect localization for main directory (e.g., ~/Dokkumente)
5 participants