• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

default system folder (Mac and win)

 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to get the default system folder on any OS .
for windows it should be"My Documents" and for Mac it should be "Pictures"

however OS folders names depend on OS current language (English, French, Spanish etc..)

System.getProperty("user.home") will give me user's home folder .
how can i get "Pictures" folder in mac and "my documents" folder in windows in a language neutral way ?

thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two aren't even equivalent, are they? Recent Windows versions have a "My Pictures" folder, and Macs have a "Documents" folder; seems like you're mixing and matching.

Each operating system has APIs for finding these special folders. You would need to use JNI, the Java Native Interface, to call OS-specific native code to find the directories (not to mention that finding them at all is going to require a digitally signed applet to get around security restrictions -- you realize that, right?)
 
Yahya Elyasse
Ranch Hand
Posts: 510
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ernest Friedman-Hill:
The two aren't even equivalent, are they? Recent Windows versions have a "My Pictures" folder, and Macs have a "Documents" folder; seems like you're mixing and matching.

Each operating system has APIs for finding these special folders. You would need to use JNI, the Java Native Interface, to call OS-specific native code to find the directories (not to mention that finding them at all is going to require a digitally signed applet to get around security restrictions -- you realize that, right?)


yes i realize that.
is there any java API out there that wrap JNI code to call OS native code and retrieve those folders ?
thanks.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there already such a library? I don't know; you can try Googling. Seems unlikely to me, however; most native programs don't even bother to do this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic