guymahieu / ivyidea

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

Add GUI option to allow translation of UNC paths #81

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Resolving a library path where the file is on a network drive accessible 
through a UNC path does not work, as IntelliJ doesn't handle UNC paths.

What version of the product are you using? On what operating system?

beta6 on windows XP

Please provide any additional information below.

We have dealt with this so far by patching DependencyResolver, so the first 
line of createExternalDependency calls the below function.

  /**
   * If the file is referenced using a UNC path, intellij will not work with it, so we assume that
   * any UNC path starting with \\ab maps to M:\
   * @param artifactFile the file to change
   * @return the new file, or the same one if there has been no change
   */
  private File substituteUncPath(File artifactFile) {

    String path = artifactFile.getPath();
    if (path.startsWith("\\\\ab")) {

      String newPath = "M:" + path.substring(4);
      return new File(newPath);

    } else {
      return artifactFile;
    }

  }

Instead of this, it would be good to have a GUI option to allow users the 
ability to translate UNC paths to something else (eg "//ab" could be mapped to 
"M:"). The GUI option, if enabled, would allow users to enter mappings in a 
table, which would be used directly by DependencyResolver, instead of 
hard-coding it in the code.

Would this be something you would be interested in adding to a future release 
as an enhancement? Would you accept a patch from us adding this functionality?

Original issue reported on code.google.com by jamiehod...@gmail.com on 20 Sep 2011 at 8:34

GoogleCodeExporter commented 8 years ago
Please fix this so we can use UNC path :)

Original comment by laid...@gmail.com on 17 Jan 2012 at 1:31

GoogleCodeExporter commented 8 years ago
I think this is a very specific use case which you can also solve by changing 
your ivysettings.xml. You could make your paths variable and let each developer 
create a property file where the mapping can be specified.

(pseudo-code ivysettings)
<ivysettings>
    <properties file="c:/my.properties" />
    <property name="root" value="//ab" />
    ...
    <filesystem>
        <ivy pattern="${root}/some/subdir/[organisation]/..." />
        <artifact pattern="${root}/some/subdir/[organisation]/..." />
    </filesystem>
</ivysettings>

Every user can specify in c:\my.properties a mapping for the //ab UNC to M: by 
giving the property 'root' a appropriate value. If the property is not 
specified, the property 'root' is defaulted to //ab

Original comment by maarten....@gmail.com on 26 Jan 2012 at 11:19