为什么IResource.getRawLocation()为IProject返回null [英] Why does IResource.getRawLocation() return null for IProject
问题描述
我需要项目文件夹的绝对位置,所以我试过
project.getRawLocation()
但这返回 null
(至少在我的情况下,已使用导入...将现有项目导入到工作空间手动导入项目,并且已经将复制项目复制到工作区中复选框)。
事情是
project.getParent()。getRawLocation()
返回 /work/Projekte/runtime-MyProduct.product
这是正确的
和
project.members()[0] .getRawLocation()
返回 /work/Projekte/runtime-MyProduct.product/Test/。 cproject
这是正确的。
因此,我希望
project.getRawLocation()
将返回 /工作/ Projekte / runti me-MyProduct.product / Test
,但它返回 null
。
解释和/或告诉我我错了什么?
JavaDoc for getRawLocation()
说
如果这个资源是现有项目中,返回的路径将为
等于项目描述中的位置路径。
和JavaDoc for项目描述 I need the absolute location of a project folder, so I tried but this returns The thing is that returns and returns Consequently, I'd expect that would return Can anyone explain and/or show me where I'm wrong? The JavaDoc for If this resource is an existing project, the returned path will be
equal to the location path in the project description. and the JavaDoc for the project description null is returned if the default location should be used The 这篇关于为什么IResource.getRawLocation()为IProject返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
getLocation()
调用将返回路径。project.getRawLocation()
null
(at least in my case in which I have imported the project manually using Import ... Existing projects into workspace and I have checked the Copy projects into workspace checkbox).project.getParent().getRawLocation()
/work/Projekte/runtime-MyProduct.product
which is correctproject.members()[0].getRawLocation()
/work/Projekte/runtime-MyProduct.product/Test/.cproject
which is correct as well.project.getRawLocation()
/work/Projekte/runtime-MyProduct.product/Test
, but it returns null
.getRawLocation()
says
IProjectDescription.getLocation()
says:
getLocation()
call will return a path.