You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by an...@apache.org on 2003/07/11 16:53:05 UTC
cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
antoine 2003/07/11 07:53:05
Modified: src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Log:
Allow FileUtilsTest to run on DOS/Windows when current drive letter is not C:
PR: 21383
Submitted by: Brad Clarke ( bclarke at booksys dot com)
Revision Changes Path
1.20 +2 -8 ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
Index: FileUtilsTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- FileUtilsTest.java 28 Jun 2003 14:18:40 -0000 1.19
+++ FileUtilsTest.java 11 Jul 2003 14:53:05 -0000 1.20
@@ -429,20 +429,14 @@
public void testToURI() {
String dosRoot = null;
if (Os.isFamily("dos")) {
- dosRoot = "C:/";
+ dosRoot = System.getProperty("user.dir").charAt(0) + ":/";
}
else
{
dosRoot = "";
}
if (Os.isFamily("dos")) {
- assertEquals("file:///"+ dosRoot + "foo", fu.toURI("c:\\foo"));
- }
- if (Os.isFamily("dos")) {
- // this amounts to : are we under cygwin ?
- if (Character.isLowerCase(System.getProperty("user.dir").charAt(0))) {
- dosRoot = "c:/";
- }
+ assertEquals("file:///C:/foo", fu.toURI("c:\\foo"));
}
assertEquals("file:///" + dosRoot + "foo", fu.toURI("/foo"));
assertEquals("file:./foo", fu.toURI("./foo"));
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Antoine Levy-Lambert wrote:
> On Windows AFAIK a path always begins with a drive letter. Let me know if
> Microsoft makes a revolution.
Users can manually edit most stuff, for example they can set
%systemdrive% to "", or start java with -Duser.home=foo, or do
similar unpleasant stuff which will not necessarily result in
an immediate system crash.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by Steve Loughran <st...@iseran.com>.
Antoine Levy-Lambert wrote:
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
> To: <de...@ant.apache.org>
> Sent: Friday, July 11, 2003 4:59 PM
> Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
> FileUtilsTest.java
>
>
>
>>is user.dir guaranteed to contain the drive letter on Windows? I
>>guess it's not guaranteed to do but always does.
>>
>
> On Windows AFAIK a path always begins with a drive letter. Let me know if
> Microsoft makes a revolution.
>
actually some versions of windows used to let you CD to a net drive
cd \\zermatt\c$
and this would cause no end of confusion from then on. NT tells you to
stop it.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by Antoine Levy-Lambert <an...@antbuild.com>.
Steve Loughran says on NT you cannot change directory to \\MachineName
On Windows 2000 it is not possible either.
Here an example (in German for those who understand)
C:\>cd \\DJ0X820J\Programme
"\\DJ0X820J\Programme" ist ein ungültiger aktueller Verzeichnispfad.
UNC-Pfade werden nicht
unterstützt.
translation:
"\\DJ0X820J\Programme" is an invalid current directory. UNC paths are not
supported.
Antoine
----- Original Message -----
From: "Magesh Umasankar" <um...@apache.org>
To: "Ant Developers List" <de...@ant.apache.org>
Sent: Saturday, July 12, 2003 12:33 AM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java
> What about network shares that are not mapped to a
> drive letter? Don't they begin with \\MachineName ?
>
> Cheers,
> Magesh
>
> ----- Original Message -----
> From: "Antoine Levy-Lambert" <an...@antbuild.com>
>
>
> > ----- Original Message -----
> > From: "Stefan Bodewig" <bo...@apache.org>
> >
> >
> > > is user.dir guaranteed to contain the drive letter on Windows? I
> > > guess it's not guaranteed to do but always does.
> > >
> > On Windows AFAIK a path always begins with a drive letter. Let me know
if
> > Microsoft makes a revolution.
> >
> > Antoine
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by Magesh Umasankar <um...@apache.org>.
What about network shares that are not mapped to a
drive letter? Don't they begin with \\MachineName ?
Cheers,
Magesh
----- Original Message -----
From: "Antoine Levy-Lambert" <an...@antbuild.com>
> ----- Original Message -----
> From: "Stefan Bodewig" <bo...@apache.org>
>
>
> > is user.dir guaranteed to contain the drive letter on Windows? I
> > guess it's not guaranteed to do but always does.
> >
> On Windows AFAIK a path always begins with a drive letter. Let me know if
> Microsoft makes a revolution.
>
> Antoine
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by Antoine Levy-Lambert <an...@antbuild.com>.
----- Original Message -----
From: "Stefan Bodewig" <bo...@apache.org>
To: <de...@ant.apache.org>
Sent: Friday, July 11, 2003 4:59 PM
Subject: Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util
FileUtilsTest.java
> is user.dir guaranteed to contain the drive letter on Windows? I
> guess it's not guaranteed to do but always does.
>
On Windows AFAIK a path always begins with a drive letter. Let me know if
Microsoft makes a revolution.
Antoine
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org
Re: cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
Posted by Stefan Bodewig <bo...@apache.org>.
On 11 Jul 2003, <an...@apache.org> wrote:
> + dosRoot = System.getProperty("user.dir").charAt(0) + ":/";
is user.dir guaranteed to contain the drive letter on Windows? I
guess it's not guaranteed to do but always does.
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org