archiecobbs / ivyroundup

Online Ivy Repository
13 stars 13 forks source link

Added new Groovy version, minor fixes to "file" syntax. #188

Closed bsoul closed 8 years ago

archiecobbs commented 8 years ago

The missing slash change doesn't look correct to me.

${target.repo} is supposed to be an absolute path, in which case (on UNIX) it will start with a forward slash already, and on Windows will start with the drive letter, so that both cases should result in a valid URL.

Maybe the problem you're seeing was created by 119ab7b5?

bsoul commented 8 years ago

That revision does not affect the leading slashes in Windows or Linux. (Perhaps a note should be added in case that question comes again). If anyone wants to test this for themselves, the following ant script (target=test-path) will prove this:

<?xml version="1.0" encoding="UTF-8"?>
<project name="test">
    <property environment="env"/> <!-- Here because it is in the roundup build.xml -->
    <pathconvert targetos="unix" property="target.repo">
        <path location="${basedir}/repo"/>
    </pathconvert>
    <property name="target.repo.old" value="${basedir}/repo" />

    <target name="test-path">
        <echo message="Basedir: ${basedir}" />
        <echo message="Current: ${target.repo}" />
        <echo message="Old: ${target.repo.old}" />
    </target>
</project>

In Linux:

Basedir: /my/path
Current: /my/path/repo
Old: /my/path/repo

Current to old gives no change.

In Windows/Cygwin:

    Basedir: c:\my\path
    Current: c:/my/path/repo
    Old: c:\my\path\repo

119ab7b only converts the slashes in Windows and does not add/remove a leading slash.

Moreover, the triple slash syntax seems to be used exclusively in the rest of the project regardless of this issue:

$ find . -type f -print0 | xargs -0 grep file://[^/] | wc -l
0
$ find . -type f -print0 | xargs -0 grep file:/// | wc -l
405

Another quick test seems to indicate that any number of leading slashes is fine in the file protocol. All of the following work on a Linux system:

curl file:///my/path/somefile.txt
curl file:////my/path/somefile.txt
curl file://///my/path/somefile.txt

The following does not work: curl file://my/path/somefile.txt

Three slashes are needed on local file systems. So file://C:/my/path/somefile.txt would also not work.

archiecobbs commented 8 years ago

OK. I don't see any problem (and am not sure why you are), but adding the extra slashes also doesn't seem to hurt anything.