JabRef needs to propose a file directory to a user for storing files. How to determine the “best” directory native for the OS the user runs.
- Low maintenance effort
- Follow JabRef’s architectural guidelines
- No additional dependencies
Chosen option: “Java Native Access”, because comes out best (see below).
Swing’s FileChooser implemented a very decent directory determination algorithm. It thereby uses
- Good, because provides best results on most platforms.
- Good, because also supports localization of the folder name. E.g.,
- Bad, because introduces a dependency on Swing and thereby contradicts the second decision driver.
- Bad, because GraalVM’s support Swing is experimental.
- Bad, because handles localization only on Windows.
- Bad, because “The concept of a HOME directory seems to be a bit vague when it comes to Windows”. See https://stackoverflow.com/a/586917/873282 for details.
- Bad, because it does not include
Documents: As of 2022,
c:\Users\USERNAMEon Windows 10, whereas
C:\Users\USERNAME\Documents, which is the “better” directory.
AppDirs is a small java library which provides a path to the platform dependent special folder/directory.
- Good, because already used in JabRef.
- Bad, because does not use
Documentson Windows, but rather
- Good, because no additional dependency required, as it is already loaded by AppDirs.
- Good, because it is well maintained and widely used.
- Good, because it provides direct access to
Documentsand other system variables.