2c00L
2c00L

Reputation: 514

Check if project exist on disk

I can check if a project exists on the Eclipse workspace with:

ResourcesPlugin.getWorkspace().getRoot().exists(IPath path)

However this does not check if the project was "soft" deleted before and already exists on disk.

How do I check if the project already exists on disk?

Upvotes: 2

Views: 782

Answers (1)

greg-449
greg-449

Reputation: 111142

You can use the the workspace location to get a normal Java File object:

IPath workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation();

IPath fullPath = workspacePath.append(relative path);

File file = fullPath.toFile();

Upvotes: 2

Related Questions