简体   繁体   English

java.awt.FileDialog过早地解析符号链接

[英]java.awt.FileDialog prematurely resolves symbolic links

I am having trouble opening files using java.awt.FileDialog without symbolic links being automatically resolved. 我在使用java.awt.FileDialog打开文件时遇到麻烦,而没有自动解析符号链接。 Eg 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 . 并且从foofoo_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 . 现在,如果我导航到/my/folder/with/links/并选择foo_link打开,则getDirectory返回/my/folder/with/originalsgetFile返回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 ... 如果需要,我可以自己使用getCanonicalFile解决此getCanonicalFile

This appears on OS X , so I don't know if this is a platform specific problem. 这出现在OS X上 ,所以我不知道这是否是特定于平台的问题。 I would like to stick to java.awt.FileDialog instead of javax.swing.JFileChooser , because the latter is really crappy on OS X. 我想坚持使用java.awt.FileDialog而不是javax.swing.JFileChooser ,因为后者在OS X上确实很糟糕。

A good alternative might be Web Look and Feel (GPL) which has a pretty good extension of JFileChooser , eg you can easily type in paths, so this would be comfortable enough for me. 一个很好的选择是Web Look and Feel (GPL),它具有JFileChooser的相当不错的扩展,例如,您可以轻松地键入路径,因此对我来说足够舒适。 One thing that would be missing from FileDialog is remembering the last five or so locations, so that will need to be implemented. FileDialog缺少的一件事是记住最后五个左右的位置,因此需要实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM