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.

+3
java jfilechooser macos


source to share


No one has answered this question yet

Check out similar questions:

five
Part of path returned from directories JFileChooser only sometimes duplicated
4
Java desktop application cannot run from folder with Russian name
2
Selecting "Computer" or "Libraries" in Java JFileChooser gives strange File object
2
JFileChooser doesn't return full filename in OSX 10.7
1
Getting Path value from JFileChooser on Windows XP
1
How do I open a network folder from Mac in Adobe Air app?
1
mac os x: get localized path
0
java file path on server should double backslah
0
JFileChooser: Cannot select Desktop when select mode is file and directories
0
How to get directory path using JFileChooser by selecting folder and not file



All Articles
Loading...
X
Show
Funny
Dev
Pics