سؤال

I am having trouble opening files using java.awt.FileDialog without symbolic links being automatically resolved. E.g. given

/my/folder/with/links
/my/folder/with/links/foo_link

And

/my/folder/with/originals
/my/folder/with/originals/foo

And there is a symbolic link from foo to foo_link. Now if I navigate to /my/folder/with/links/ and select foo_link to open, then getDirectory returns /my/folder/with/originals and getFile returns foo. But I really need to have a handle on the actually selected folder. If I need to, I can resolve this stuff myself using getCanonicalFile...

This appears on OS X, so I don't know if this is a platform specific problem. I would like to stick to java.awt.FileDialog instead of javax.swing.JFileChooser, because the latter is really crappy on OS X.

هل كانت مفيدة؟

المحلول

A good alternative might be Web Look and Feel (GPL) which has a pretty good extension of JFileChooser, e.g. you can easily type in paths, so this would be comfortable enough for me. One thing that would be missing from FileDialog is remembering the last five or so locations, so that will need to be implemented.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top