Skip to content

Commit 6788d88

Browse files
committed
Fix Windows path separator in linked folder name
On Windows, Path.relativize() produces backslash separators (e.g., ..\parent\src\main\java). The existing replace('/', '_') only handled forward slashes, leaving backslashes intact. This caused project.getFolder() to interpret '..' as parent traversal, resulting in 'Cannot create linked resource' errors. Replace both separators to produce correct link names on all platforms.
1 parent a084130 commit 6788d88

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ protected IContainer getFolder(IProject project, String path) throws CoreExcepti
10111011
return null;
10121012
}
10131013
}
1014-
String linkName = relativized.toString().replace("/", "_");
1014+
String linkName = relativized.toString().replace("\\", "_").replace("/", "_");
10151015
IFolder folder = project.getFolder(linkName);
10161016
createLinkWithRetry(folder, folderPath.toUri());
10171017
folder.setPersistentProperty(LINKED_MAVEN_RESOURCE, "true");

0 commit comments

Comments
 (0)