Name resolution of localized folders returned by JFileChooser on Mac OS
In Mac OS, certain folders such as " Desktop
" or " Applications
" are localized so that they are named in the Finder, for example, " Schreibtisch
" and " Programme
" in German. This leads to problems with JFileChooser in Java
.
When I configure JFileChooser
to only allow directory selection using the method setFileSelectionMode
and the user selects " Schreibtisch
", the path I get back from the dialog is */Users/username/Schreibtisch*
. Obviously this folder does not exist because it is a localized name */Users/username/Desktop*
.
File.exists()
or File.isDirectory()
both return false and getCanonicalPath () does not allow localization. Is there a way to get the "physical" path from the localized one?
It's weird when the user selects a subfolder " Schreibtisch
" like the */Users/username/Schreibtisch/images*
returned path */Users/username/Desktop/images*
, which is correct.
source to share
No one has answered this question yet
Check out similar questions: