Skip to main content

path to windows 7 'libraries' from JFileChooser

1 reply [Last post]
chrisn25
Offline
Joined: 2010-08-10

Hi

I am running windows 7 - 64 bit. Java version is 1.6.0_20.

Our software uses a JFileChooser to display the dialog to create a new file/project. After passing the if statement in the fragment below the user has chosen his file.

if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(parentFrame))
{
File file = chooser.getSelectedFile();
etc

If the user navigated to one of windows 7's new 'libraries' then the path associated with the file that is returned on the next line by the getSelectedFile() method is not a valid path. It looks like:

::{031E4825-7B94-4DC3-B131-E946B44C8DD5}\Documents.library-ms\sdfg

where sdfg is the filename. This isn't flagged immediately, but the root cause is here. The new windows 7 libraries are not filesystem locations, but some sort of reference (although they appear in the filesystem), so I can see why it is like this, but it is a problem, because they do link to filesystem locations.

I have ended up writing some incomplete and not ideal path substitution methods as a work around. Anyone know any proper way of dealing with this? Is quite hard to search for anything to do with libraries, so I have not managed to find anything.

Cheers

Chris

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
anthony_p
Offline
Joined: 2006-07-24

This is obviously a bug, but not in the JFileChooser, of course, but in java.io/java.nio classes.

I suggest to submit a bug report at http://bugs.sun.com/