0
ABS路徑我有同樣的問題,因爲在這個崗位的傢伙: Get the absolute path of the currently edited file in Eclipse獲取從當前編輯的文件在Eclipse
,但我不知道如何做到這一點。在帖子中,他們說我應該使用IResource.getRawLocation(),但是如何從當前正在查看的文件中獲取IResource?
IFile file2 = (IFile)workBench.getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput().getAdapter(IFile.class);
IPath path = file2.getRawLocation().makeAbsolute();
String ss = path.toString();
System.out.println(ss);
但這仍然不會給我鏈接文件中的正確的道路,我得到的是這樣的: /路徑/到/插件/路徑/到/相對/路徑/到/文件
我認爲它的工作:) – hidayat 2010-06-16 14:47:09