I’d like to create a directory in the user’s ‘Documents’ folder, but so far I’ve only found out how to get the user’s home directory:
javax.swing.JFileChooser fr = new javax.swing.JFileChooser(); javax.swing.filechooser.FileSystemView fw = fr.getFileSystemView(); this.userDirectory = fw.getDefaultDirectory();
In Windows the above code returns the ‘My Documents’ directory, which is great, that’s where the new documents are supposed to go. On OS X it only returns the home directory.
Adding ‘Documents’ to the returned path would cause problems with localization.
How can I do this?
System.getProperty(‘user.home’)+File.separator+’Documents’;
And don’t worry about with localization, look:
My OS X is in Spanish.