• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

default system folder (Mac and win)

 
Ranch Hand
Posts: 510
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic