windows vs linux paths in properties

View: New views
12 Messages — Rating Filter:   Alert me  

windows vs linux paths in properties

by Jasper Floor-2 :: Rate this Message:

| View Threaded | Show Only this Message

HI,

I have an ivy settings with the follwing two lines

    <properties file="${basedir}/ivy.properties" override="true"/>
    <properties file="${user.home}/.m4n.properties" override="true"/>

Now, this works fine with linux (and presumably MacOs as noone has
complained yet).

This fails terribly in windows because of the /
The reason, obviously is that the / should be a \ in windows.
Is there any way to solve this in the ivy settings file?


mvg,
Jasper

Re: windows vs linux paths in properties

by Alex Foreman-2 :: Rate this Message:

| View Threaded | Show Only this Message

try:
${file.separator}  instead of the '/'

HTH

On 27 March 2012 15:27, Jasper Floor <jasper.floor@...> wrote:

> HI,
>
> I have an ivy settings with the follwing two lines
>
>    <properties file="${basedir}/ivy.properties" override="true"/>
>    <properties file="${user.home}/.m4n.properties" override="true"/>
>
> Now, this works fine with linux (and presumably MacOs as noone has
> complained yet).
>
> This fails terribly in windows because of the /
> The reason, obviously is that the / should be a \ in windows.
> Is there any way to solve this in the ivy settings file?
>
>
> mvg,
> Jasper

Re: windows vs linux paths in properties

by Matt Hurne :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 10:27 AM, Jasper Floor <jasper.floor@...> wrote:

> HI,
>
> I have an ivy settings with the follwing two lines
>
>    <properties file="${basedir}/ivy.properties" override="true"/>
>    <properties file="${user.home}/.m4n.properties" override="true"/>
>
> Now, this works fine with linux (and presumably MacOs as noone has
> complained yet).
>
> This fails terribly in windows because of the /
> The reason, obviously is that the / should be a \ in windows.
> Is there any way to solve this in the ivy settings file?


That's strange; we use / in our Ant build files (including in file
attributes of property elements) on Windows without issue.

Re: windows vs linux paths in properties

by Jasper Floor-2 :: Rate this Message:

| View Threaded | Show Only this Message

Thanks, works perfectly!

On Tue, Mar 27, 2012 at 4:30 PM, Alex Foreman <alexdforeman@...> wrote:

> try:
> ${file.separator}  instead of the '/'
>
> HTH
>
> On 27 March 2012 15:27, Jasper Floor <jasper.floor@...> wrote:
>> HI,
>>
>> I have an ivy settings with the follwing two lines
>>
>>    <properties file="${basedir}/ivy.properties" override="true"/>
>>    <properties file="${user.home}/.m4n.properties" override="true"/>
>>
>> Now, this works fine with linux (and presumably MacOs as noone has
>> complained yet).
>>
>> This fails terribly in windows because of the /
>> The reason, obviously is that the / should be a \ in windows.
>> Is there any way to solve this in the ivy settings file?
>>
>>
>> mvg,
>> Jasper

Re: windows vs linux paths in properties

by Jasper Floor-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 4:33 PM, Matt Hurne <matt@...> wrote:

> On Tue, Mar 27, 2012 at 10:27 AM, Jasper Floor <jasper.floor@...> wrote:
>> HI,
>>
>> I have an ivy settings with the follwing two lines
>>
>>    <properties file="${basedir}/ivy.properties" override="true"/>
>>    <properties file="${user.home}/.m4n.properties" override="true"/>
>>
>> Now, this works fine with linux (and presumably MacOs as noone has
>> complained yet).
>>
>> This fails terribly in windows because of the /
>> The reason, obviously is that the / should be a \ in windows.
>> Is there any way to solve this in the ivy settings file?
>
>
> That's strange; we use / in our Ant build files (including in file
> attributes of property elements) on Windows without issue.

The properties lines above are from an ivy-settings.xml file.
Conceptually I think these settings belong with Ivy not with Ant. I
was considering moving them to Ant if I couldn't get Ivy to do what I
wanted. Luckilly Alex Foreman had the answer ready.

Re: windows vs linux paths in properties

by Matt Hurne :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 11:32 AM, Jasper Floor <jasper.floor@...> wrote:

> On Tue, Mar 27, 2012 at 4:33 PM, Matt Hurne <matt@...> wrote:
>> On Tue, Mar 27, 2012 at 10:27 AM, Jasper Floor <jasper.floor@...> wrote:
>>> HI,
>>>
>>> I have an ivy settings with the follwing two lines
>>>
>>>    <properties file="${basedir}/ivy.properties" override="true"/>
>>>    <properties file="${user.home}/.m4n.properties" override="true"/>
>>>
>>> Now, this works fine with linux (and presumably MacOs as noone has
>>> complained yet).
>>>
>>> This fails terribly in windows because of the /
>>> The reason, obviously is that the / should be a \ in windows.
>>> Is there any way to solve this in the ivy settings file?
>>
>>
>> That's strange; we use / in our Ant build files (including in file
>> attributes of property elements) on Windows without issue.
>
> The properties lines above are from an ivy-settings.xml file.
> Conceptually I think these settings belong with Ivy not with Ant. I
> was considering moving them to Ant if I couldn't get Ivy to do what I
> wanted. Luckilly Alex Foreman had the answer ready.


That makes sense.  Sorry for the confusion on my part.  No doubt
it would be nice if Ivy would tolerate \ in addition to / the way Ant
does.

Re: windows vs linux paths in properties

by Tim Brown-12 :: Rate this Message:

| View Threaded | Show Only this Message

Odd.  The unix style path separator should work fine.

You could try replacing the / with ${file.separator} and see if the
result is different

~Sent from my mobile device. Please pardon any oddities :-)

On Mar 27, 2012, at 10:27 AM, Jasper Floor <jasper.floor@...> wrote:

> HI,
>
> I have an ivy settings with the follwing two lines
>
>    <properties file="${basedir}/ivy.properties" override="true"/>
>    <properties file="${user.home}/.m4n.properties" override="true"/>
>
> Now, this works fine with linux (and presumably MacOs as noone has
> complained yet).
>
> This fails terribly in windows because of the /
> The reason, obviously is that the / should be a \ in windows.
> Is there any way to solve this in the ivy settings file?
>
>
> mvg,
> Jasper

Re: windows vs linux paths in properties

by James Moore-8 :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 7:27 AM, Jasper Floor <jasper.floor@...> wrote:

> This fails terribly in windows because of the /
> The reason, obviously is that the / should be a \ in windows.\
>

That shouldn't be the problem; both \ and / are file separators in Windows
and always have been.  There are some Windows tools that use / as something
other than a file separator (like cmd), but that's a specific issue for
that specific tool.

--
James Moore
james@...
http://blog.restphone.com/
http://www.linkedin.com/in/jamesmmooreiv

Re: windows vs linux paths in properties

by Matt Hurne :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 2:27 PM, James Moore <james@...> wrote:

> On Tue, Mar 27, 2012 at 7:27 AM, Jasper Floor <jasper.floor@...> wrote:
>
>> This fails terribly in windows because of the /
>> The reason, obviously is that the / should be a \ in windows.\
>>
>
> That shouldn't be the problem; both \ and / are file separators in Windows
> and always have been.  There are some Windows tools that use / as something
> other than a file separator (like cmd), but that's a specific issue for
> that specific tool.

Jasper, can you be more specific about what behavior you see when
using forward slashes (/)?  Like the others, I double-checked and can
confirm that we are using forward slashes in <property> elements in
our ivysettings.xml on Windows without issue.  Notice the difference
though: you said you are having issues with the <properties> element,
not the <property> element that we are using them in without issue.
We are not currently using the <properties> element, but maybe I'll
try it when I get a chance.

Re: windows vs linux paths in properties

by Matt Hurne :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 2:52 PM, Matt Hurne <matt@...> wrote:

> On Tue, Mar 27, 2012 at 2:27 PM, James Moore <james@...> wrote:
>> On Tue, Mar 27, 2012 at 7:27 AM, Jasper Floor <jasper.floor@...> wrote:
>>
>>> This fails terribly in windows because of the /
>>> The reason, obviously is that the / should be a \ in windows.\
>>>
>>
>> That shouldn't be the problem; both \ and / are file separators in Windows
>> and always have been.  There are some Windows tools that use / as something
>> other than a file separator (like cmd), but that's a specific issue for
>> that specific tool.
>
> Jasper, can you be more specific about what behavior you see when
> using forward slashes (/)?  Like the others, I double-checked and can
> confirm that we are using forward slashes in <property> elements in
> our ivysettings.xml on Windows without issue.  Notice the difference
> though: you said you are having issues with the <properties> element,
> not the <property> element that we are using them in without issue.
> We are not currently using the <properties> element, but maybe I'll
> try it when I get a chance.

I did test out a <properties> element in my ivysettings.xml on Windows
(XP) with forward slashes as file separators and I did not see any
issues.

Re: windows vs linux paths in properties

by Jasper Floor-2 :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Mar 27, 2012 at 8:52 PM, Matt Hurne <matt@...> wrote:

> On Tue, Mar 27, 2012 at 2:27 PM, James Moore <james@...> wrote:
>> On Tue, Mar 27, 2012 at 7:27 AM, Jasper Floor <jasper.floor@...> wrote:
>>
>>> This fails terribly in windows because of the /
>>> The reason, obviously is that the / should be a \ in windows.\
>>>
>>
>> That shouldn't be the problem; both \ and / are file separators in Windows
>> and always have been.  There are some Windows tools that use / as something
>> other than a file separator (like cmd), but that's a specific issue for
>> that specific tool.
>
> Jasper, can you be more specific about what behavior you see when
> using forward slashes (/)?  Like the others, I double-checked and can
> confirm that we are using forward slashes in <property> elements in
> our ivysettings.xml on Windows without issue.  Notice the difference
> though: you said you are having issues with the <properties> element,
> not the <property> element that we are using them in without issue.
> We are not currently using the <properties> element, but maybe I'll
> try it when I get a chance.


One of the properties files being loaded above contains the
credentials for our Nexus. No anonymous access allowed (sysadmin
decision). Using the  ${file.separator} at least made the path look
normal. Unfortunately Nexus still only seems to allow you in if you
have every single right. That is another problem however. So I thought
the credentials weren't being loaded, and I think I saw evidence of
that in the output (ant -d -v). I'll test it again just to confirm
this, but it might take a while. I don't work with windows here so I
have to corner someone who does.

mvg,
Jasper

Re: windows vs linux paths in properties

by Matt Hurne :: Rate this Message:

| View Threaded | Show Only this Message

On Wed, Mar 28, 2012 at 4:43 AM, Jasper Floor <jasper.floor@...> wrote:

> On Tue, Mar 27, 2012 at 8:52 PM, Matt Hurne <matt@...> wrote:
>> On Tue, Mar 27, 2012 at 2:27 PM, James Moore <james@...> wrote:
>>> On Tue, Mar 27, 2012 at 7:27 AM, Jasper Floor <jasper.floor@...> wrote:
>>>
>>>> This fails terribly in windows because of the /
>>>> The reason, obviously is that the / should be a \ in windows.\
>>>>
>>>
>>> That shouldn't be the problem; both \ and / are file separators in Windows
>>> and always have been.  There are some Windows tools that use / as something
>>> other than a file separator (like cmd), but that's a specific issue for
>>> that specific tool.
>>
>> Jasper, can you be more specific about what behavior you see when
>> using forward slashes (/)?  Like the others, I double-checked and can
>> confirm that we are using forward slashes in <property> elements in
>> our ivysettings.xml on Windows without issue.  Notice the difference
>> though: you said you are having issues with the <properties> element,
>> not the <property> element that we are using them in without issue.
>> We are not currently using the <properties> element, but maybe I'll
>> try it when I get a chance.
>
>
> One of the properties files being loaded above contains the
> credentials for our Nexus. No anonymous access allowed (sysadmin
> decision). Using the  ${file.separator} at least made the path look
> normal. Unfortunately Nexus still only seems to allow you in if you
> have every single right. That is another problem however. So I thought
> the credentials weren't being loaded, and I think I saw evidence of
> that in the output (ant -d -v). I'll test it again just to confirm
> this, but it might take a while. I don't work with windows here so I
> have to corner someone who does.


I'd prefer not to be using Windows myself.

I learned a bit from this Wikipedia page about how Windows handles
path separators:
http://en.wikipedia.org/wiki/Path_%28computing%29#MS-DOS.2FMicrosoft_Windows_style

Note that when Ivy attempts to load the file pointed to by the
<properties> element, it does so by first passing the attribute to
"new URL(filePath)", and if that throws an exception, it passes it to
"new File(filePath)".  So whatever behavior you would normally expect
from those constructors should apply here as well.