检查磁盘上是否存在项目

Check if project exist on disk

我可以检查 Eclipse 工作区中是否存在项目:

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

然而,这不会检查项目是否已被 "soft" 删除并且已经存在于磁盘上。

如何检查磁盘上是否已存在该项目?

您可以使用工作区位置来获取正常的 Java File 对象:

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

IPath fullPath = workspacePath.append(relative path);

File file = fullPath.toFile();