如何让 OS X 识别驱动器号?
可能的重复:
如何让 OS X 识别驱动器盘符?
我知道。异端。但我陷入了困境。我有很多使用绝对路径名的配置文件,这导致 OS X 和 Windows 之间不兼容。如果我能让 OS X(我敢打赌这是两者中更灵活的一个)将“Q:/foo/bar/bim.properties”识别为有效的绝对文件名,它将节省我的时间 通过堆栈跟踪和配置文件来探索工作。
最后,我需要这段 Java 测试代码来打印“SUCCESS!”当它运行时:
import java.io.*; class DriveLetterTest { static public void main(String... args) { File f = new File("S:"); if (f.isDirectory()) { System.out.println("SUCCESS!"); } else { System.out.println("FAIL!"); } } }
有人知道这是如何做到的吗?
Possible Duplicate:
How can I make OS X recognize drive letters?
I know. Heresy. But I'm in a bind. I have a lot of config files that use absolute path names, which creates an incompatibility between OS X and Windows. If I can get OS X (which I'm betting is the more flexible of the two) to recognize "Q:/foo/bar/bim.properties" as a valid absolute file name, it'll save me days of work spelunking through stack traces and config files.
In the end, I need this bit of Java test code to print "SUCCESS!" when it runs:
import java.io.*; class DriveLetterTest { static public void main(String... args) { File f = new File("S:"); if (f.isDirectory()) { System.out.println("SUCCESS!"); } else { System.out.println("FAIL!"); } } }
Anyone know how this can be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不愿意更改每个操作系统的配置文件,那么它们首先是用来做什么的?
每个安装都应该有自己的一组配置文件并相应地使用它。
但如果你坚持..你只需要检测操作系统版本,如果不是Windows,请忽略这封信:
大意是:
你明白了
If you are not willing to change your config file per OS, what are they for in first place?
Every installation should have its own set of config files and use it accordingly.
But if you insist.. you just have to detect the OS version and if is not Windows, ignore the letter:
Something along the lines:
You get the idea