[英]Eclipse PDE looking for the absolute path for the file (or relative path)
这是我现在拥有的代码,但 output 是: /Users/zakariasfridriksson/runtime-EclipseApplication/is.ru.cs.PapyrusActivityLogger.example (runtime-EclipseApplication 这是错误的,就像它缺少路径的某些部分)
代码:
IProject project = root.getProject("is.ru.cs.PapyrusActivityLogger.example");
System.out.println(project.getFullPath());
IFile csv = project.getFile("logger.csv");
String finaldestination = root.getLocation().toString() + project.getFullPath();
System.out.println(finaldestination);
您可以在IFile
上调用getLocation
:
IPath csvPath = csv.getLocation();
String dest = csvPath.toOSString();
注意: runtime-EclipseApplication
是 Eclipse 在您使用“Run as Eclipse Application”运行插件时为您创建的测试工作区。 所以你的原始代码也给出了正确的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.