简体   繁体   中英

get IFile[] using Path

I have the org.eclipse.core.runtime.Path object. This will have some value like Test/src/jsp -- where Test is the project name. From this I want to get the list of files ie IFile[], in that path. Can you please suggest a way.

You can get the src/ folder via IFolder folder = project.getFolder(new Path("/src/")) and then getting all resources from this Folder via IResource[] resources = folder.members() .

So you only need to extract all IFiles eg

for(IResource resource : resources) {
if(resource instanceof IFile)
//do something
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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