mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
isSymbolicLinkSupported() extracted
This commit is contained in:
parent
42931e5db1
commit
a05ee48bd1
1 changed files with 14 additions and 2 deletions
|
@ -510,6 +510,18 @@ public class ResourceHelper {
|
||||||
return createEfsFolder(project,folderLink,new URI(realFolder));
|
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
|
* Creates new symbolic file system link from file or folder on project root
|
||||||
* to another file system file. The filename can include relative path
|
* 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)
|
public static IResource createSymbolicLink(IProject project, String linkName, IPath realPath)
|
||||||
throws IOException, CoreException, UnsupportedOperationException {
|
throws IOException, CoreException, UnsupportedOperationException {
|
||||||
|
|
||||||
if (Platform.getOS().equals(Platform.OS_WIN32)) {
|
if (!isSymbolicLinkSupported()) {
|
||||||
throw new UnsupportedOperationException("Windows links .lnk are not supported.");
|
throw new UnsupportedOperationException("Windows links .lnk are not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +574,7 @@ public class ResourceHelper {
|
||||||
* @throws IOException if execution of the command fails.
|
* @throws IOException if execution of the command fails.
|
||||||
*/
|
*/
|
||||||
public static void createSymbolicLink(IPath linkPath, IPath realPath) throws IOException {
|
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.");
|
throw new UnsupportedOperationException("Windows links .lnk are not supported.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue