guymahieu / ivyidea

Resolve dependencies for your Intellij projects using Ivy
Apache License 2.0
13 stars 18 forks source link

Windows UNC paths not translated correctly #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Ivy successfully resolves our ivy.xml -- which we use in Eclipse IvyDE without 
issue, so resolver is okay -- but the paths translated for libraries of the form

//foo/bar/1.0.0/lib/bar.jar

which should translate to this on Windows

\\foo\bar\1.0.0\lib\bar.jar

instead translate to:

\foo\bar\1.0.0\lib\bar.jar

which is incorrect. The Ivy resolver is defined to match pattern="//foo/..." so 
I am pretty sure the issue is on the IvyIDEA side.

Seen with IvyIDEA 0.9-beta4 on Windows XP with IntelliJ 10.0.1.

Original issue reported on code.google.com by kyle.dow...@gmail.com on 8 Feb 2011 at 7:36

GoogleCodeExporter commented 8 years ago
Downloaded the code and I have a suspicion the issue is inside 
VirtualFileFactory ... I don't know the IntelliJ API, but (a) I think the 
accepted way to convert a File to a URL in newer versions of Java is 
File.toURI().toURL(); (b) the two methods below seem to be inconsistent ... 
couldn't you use findFileByUrl for both by pre-pending the file: URL with jar: 
and appending the JAR path, i.e. jar:file:////foo/bar/1.0.0/lib/bar.jar!/  ... ?

    protected static VirtualFile createFromRegularFile(@NotNull File file) {
        return VirtualFileManager.getInstance().findFileByUrl("file://" + file.getAbsolutePath());
    }

    protected static VirtualFile createFromJarFile(@NotNull File file) {
        return JarFileSystem.getInstance().findFileByPath(file.getAbsolutePath() + JarFileSystem.JAR_SEPARATOR);
    }

Original comment by kyle.dow...@gmail.com on 8 Feb 2011 at 8:34

GoogleCodeExporter commented 8 years ago
It seems that IntelliJ itself doesn't allow UNC paths as valid library paths... 
So there is nothing we can do about this I'm afraid.

Please reopen if you don't agree...

Maarten

Original comment by maarten....@gmail.com on 12 Aug 2011 at 10:32