From a05ee48bd113430207767a4dbb96dded16890aaa Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Thu, 2 Jun 2011 19:52:39 +0000 Subject: [PATCH] isSymbolicLinkSupported() extracted --- .../cdt/core/testplugin/ResourceHelper.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/ResourceHelper.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/ResourceHelper.java index 104f058a734..3804d529014 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/ResourceHelper.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/ResourceHelper.java @@ -510,6 +510,18 @@ public class ResourceHelper { return createEfsFolder(project,folderLink,new URI(realFolder)); } + /** + * Checks if symbolic links are supported on the system. + * Used in particular by method {@link #createSymbolicLink(IPath, IPath)} + * and other flavors to create symbolic links. + * + * Note that Windows links .lnk are not supported here. + * @return {@code true} if symbolic links are suppoted, {@code false} otherwise. + */ + public static boolean isSymbolicLinkSupported() { + return ! Platform.getOS().equals(Platform.OS_WIN32); + } + /** * Creates new symbolic file system link from file or folder on project root * to another file system file. The filename can include relative path @@ -527,7 +539,7 @@ public class ResourceHelper { public static IResource createSymbolicLink(IProject project, String linkName, IPath realPath) throws IOException, CoreException, UnsupportedOperationException { - if (Platform.getOS().equals(Platform.OS_WIN32)) { + if (!isSymbolicLinkSupported()) { throw new UnsupportedOperationException("Windows links .lnk are not supported."); } @@ -562,7 +574,7 @@ public class ResourceHelper { * @throws IOException if execution of the command fails. */ public static void createSymbolicLink(IPath linkPath, IPath realPath) throws IOException { - if (Platform.getOS().equals(Platform.OS_WIN32)) { + if (!isSymbolicLinkSupported()) { throw new UnsupportedOperationException("Windows links .lnk are not supported."); }