Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ protected void makeLinkStructure() throws CoreException, IOException {
llFile = baseStore.getChild("llFile");
ensureExists(aDir, true);
ensureExists(aFile, false);
mkLink(baseStore, "lDir", "aDir", true);
mkLink(baseStore, "llDir", "lDir", true);
mkLink(baseStore, "lFile", "aFile", false);
mkLink(baseStore, "llFile", "lFile", false);
mkLink(baseStore, "lDir", "aDir");
mkLink(baseStore, "llDir", "lDir");
mkLink(baseStore, "lFile", "aFile");
mkLink(baseStore, "llFile", "lFile");
fetchFileInfos();
}

protected void mkLink(IFileStore dir, String src, String tgt, boolean isDir) throws IOException, CoreException {
FileSystemHelper.createSymLink(dir.toLocalFile(EFS.NONE, getMonitor()), src, tgt, isDir);
protected void mkLink(IFileStore dir, String src, String tgt) throws IOException, CoreException {
FileSystemHelper.createSymLink(dir.toLocalFile(EFS.NONE, getMonitor()), src, tgt);
}

@Test
Expand Down Expand Up @@ -209,8 +209,8 @@ public void testBrokenSymlinkRemove() throws Exception {
@Test
public void testRecursiveSymlink() throws Exception {
IFileStore baseStore = fileStoreExtension.getFileStore();
mkLink(baseStore, "l1", "l2", false);
mkLink(baseStore, "l2", "l1", false);
mkLink(baseStore, "l1", "l2");
mkLink(baseStore, "l2", "l1");
IFileStore l1 = baseStore.getChild("l1");
IFileInfo i1 = l1.fetchInfo();
assertEquals(SYMLINKS_ARE_FIRST_CLASS_FILES_OR_DIRECTORIES, i1.exists());
Expand Down Expand Up @@ -343,8 +343,8 @@ public void _testSymlinkExtendedChars() throws Exception {
ensureExists(childDir, true);
IFileStore childFile = baseStore.getChild("ff" + specialCharName);
ensureExists(childFile, false);
mkLink(baseStore, "l" + specialCharName, specialCharName, true);
mkLink(baseStore, "lf" + specialCharName, "ff" + specialCharName, false);
mkLink(baseStore, "l" + specialCharName, specialCharName);
mkLink(baseStore, "lf" + specialCharName, "ff" + specialCharName);
IFileInfo[] infos = baseStore.childInfos(EFS.NONE, getMonitor());
assertThat(infos).hasSize(4);
assertThat(infos).allSatisfy(info -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
@ExtendWith(WorkspaceResetExtension.class)
public class SymlinkResourceTest {

private void mkLink(IFileStore dir, String src, String tgt, boolean isDir) throws CoreException, IOException {
createSymLink(dir.toLocalFile(EFS.NONE, createTestMonitor()), src, tgt, isDir);
private void mkLink(IFileStore dir, String src, String tgt) throws CoreException, IOException {
createSymLink(dir.toLocalFile(EFS.NONE, createTestMonitor()), src, tgt);
}

protected void createBug232426Structure(IFileStore rootDir) throws CoreException, IOException {
Expand All @@ -61,18 +61,18 @@ protected void createBug232426Structure(IFileStore rootDir) throws CoreException
folderC.mkdir(EFS.NONE, createTestMonitor());

/* create symbolic links */
mkLink(folderA, "link", IPath.fromOSString("../b").toOSString(), true);
mkLink(folderB, "linkA", IPath.fromOSString("../a").toOSString(), true);
mkLink(folderB, "linkC", IPath.fromOSString("../c").toOSString(), true);
mkLink(folderC, "link", IPath.fromOSString("../b").toOSString(), true);
mkLink(folderA, "link", IPath.fromOSString("../b").toOSString());
mkLink(folderB, "linkA", IPath.fromOSString("../a").toOSString());
mkLink(folderB, "linkC", IPath.fromOSString("../c").toOSString());
mkLink(folderC, "link", IPath.fromOSString("../b").toOSString());
}

protected void createBug358830Structure(IFileStore rootDir) throws CoreException, IOException {
IFileStore folderA = rootDir.getChild("a");
folderA.mkdir(EFS.NONE, createTestMonitor());

/* create trivial recursive symbolic link */
mkLink(folderA, "link", IPath.fromOSString("../").toOSString(), true);
mkLink(folderA, "link", IPath.fromOSString("../").toOSString());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1773,7 +1773,7 @@ public void testLinkedFolderWithSymlink_Bug338010() throws Exception {
fileStoreExtension.deleteOnTearDown(resolvedBaseLocation);
IPath symlinkTarget = resolvedBaseLocation.append("dir1/target");
symlinkTarget.toFile().mkdirs();
createSymLink(resolvedBaseLocation.toFile(), "symlink", symlinkTarget.toOSString(), true);
createSymLink(resolvedBaseLocation.toFile(), "symlink", symlinkTarget.toOSString());
IPath linkChildLocation = baseLocation.append("symlink/dir2");
IPath resolvedLinkChildLocation = resolve(linkChildLocation);
File linkChild = resolvedLinkChildLocation.toFile();
Expand All @@ -1800,7 +1800,7 @@ public void testDeleteLinkTarget_Bug507084() throws Exception {
symlinkTarget.append("B/C").toFile().mkdirs();
IPath linkParentDir = resolvedBaseLocation.append("dir2");
linkParentDir.toFile().mkdirs();
createSymLink(linkParentDir.toFile(), "symlink", symlinkTarget.toOSString(), true);
createSymLink(linkParentDir.toFile(), "symlink", symlinkTarget.toOSString());

IFolder folder = nonExistingFolderInExistingProject;
IPath symLink = linkParentDir.append("symlink");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void testAttributeSymlink() throws Exception {

// create a link to the target file and add it to the workspace,
// the resource in the workspace should have symbolic link attribute set
createSymLink(project.getLocation().toFile(), "link", "target", false);
createSymLink(project.getLocation().toFile(), "link", "target");
createInWorkspace(link);
assertTrue(link.getResourceAttributes().isSymbolicLink());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public void testWorkingLocationDeletion_bug433061() throws Throwable {
assertTrue(file.exists());
// Create a symlink in the working location of the project pointing to
// linkTarget.
createSymLink(workingLocation.toFile(), "link", linkTarget.toOSString(), true);
createSymLink(workingLocation.toFile(), "link", linkTarget.toOSString());
monitor.prepare();
project.delete(true, monitor);
monitor.assertUsedUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ private static void createDirectory(File directory) {

void createSymlink(File directory, String linkName, String linkTarget) throws IOException {
assertTrue(canCreateSymLinks(), "symlinks not supported by platform");
boolean isDir = true;
createSymLink(directory, linkName, linkTarget, isDir);
createSymLink(directory, linkName, linkTarget);
}

private IProject importProjectAndRefresh(String projectName, URI projectRootLocation) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void requireCanCreateSymlinks() throws IOException {
*/
protected void symLinkAndRefresh(IContainer container, String linkName, IPath linkTarget)
throws CoreException, IOException {
createSymLink(container.getLocation().toFile(), linkName, linkTarget.toOSString(), false);
createSymLink(container.getLocation().toFile(), linkName, linkTarget.toOSString());
container.refreshLocal(IResource.DEPTH_INFINITE, createTestMonitor());
IResource theLink = container.findMember(linkName);
assertExistsInWorkspace(theLink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,14 @@ public static void clear(java.io.File file) {
* @param basedir folder in which the symbolic link should be created
* @param linkName name of the symbolic link
* @param linkTarget target to which the symbolic link should point
* @param isDir unused, retained for compatibility
* @throws FileSystemException if the link could not be created, e.g.
* due to missing privileges on Windows
* @throws UnsupportedOperationException if symbolic links are generally not
* supported on the current platform
* @throws IOException in case the creation of the symlink
* failed for other reasons
*/
public static void createSymLink(File basedir, String linkName, String linkTarget, boolean isDir)
public static void createSymLink(File basedir, String linkName, String linkTarget)
throws IOException {
Files.createSymbolicLink(basedir.toPath().resolve(linkName), Path.of(linkTarget));
}
Expand All @@ -143,7 +142,7 @@ public static boolean canCreateSymLinks() throws IOException {
String linkName = FileSystemHelper.getRandomLocation(tempDir).lastSegment();
try {
// Try to create a symlink.
createSymLink(tempDir.toFile(), linkName, "testTarget", false);
createSymLink(tempDir.toFile(), linkName, "testTarget");
// Clean up if the link was created.
new File(tempDir.toFile(), linkName).delete();
canCreateSymLinks = Boolean.TRUE;
Expand Down
Loading