Ravi Kumar
Ravi Kumar

Reputation: 341

Getting current working workspace directory of eclipse through plugin

I am developing an eclipse plugin. But through plugin instead of getting current working workspace directory, its getting eclipse exe directory. How could i get the workspace directory through plugin ?

Upvotes: 0

Views: 250

Answers (1)

greg-449
greg-449

Reputation: 111142

To get the root directory of the current workspace use:

IWorkspace workspace = ResourcesPlugin.getWorkspace();

IWorkspaceRoot root = workspace.getRoot();

IPath rootPath = root.getLocation();

IPath has a toFile() to get a File or toOSString() to convert to a String.

Upvotes: 2

Related Questions