I was under the impression / would _always_ work, on either platform
when passing a path to the File class.

The String version is definitely not going to do much for you, it
doesn't know it's supposed to be a path.

Here's a quick test I whipped up, outputting whether a file exists
given a relative path to it with both Windows and Linux path
separators on both platforms:

----Test.java------------------
import java.io.File;

public class Test {

   public static void main(String[] args) {
       System.out.println("args[0]: " + args[0]);

       File f = new File(args[0]);
       System.out.println(f.getAbsolutePath() + " exists? " + f.exists());
   }
}

-----------------------------

Running this on my main machine (linux):

[EMAIL PROTECTED] ~ $ java Test Desktop\\Movies
args[0]: Desktop\Movies
/home/nick/Desktop\Movies exists? false
[EMAIL PROTECTED] ~ $ java Test "Desktop/Movies"
args[0]: Desktop/Movies
/home/nick/Desktop/Movies exists? true

-----------------------------

Running this on my windows VM:

C:\DOCUME~1\nick>java Test Desktop/test
args[0]: Desktop/test
C:\DOCUME~1\nick\Desktop\test exists? true

C:\DOCUME~1\nick>java Test Desktop\test
args[0]: Desktop\test
C:\DOCUME~1\nick\Desktop\test exists? true

-----------------------------

So as you can see, the File class is tolerant of windows, but the /
path separator works in both cases.  I would just stick with that.  I
don't really know exactly what issue this was causing you, unless it
was just confusion on the Windows-user side.  Actual manipulation of
the file should always work if you use / separators in relative paths.

On 8/27/06, Jimisola Laursen <[EMAIL PROTECTED]> wrote:

I've changed the parameter from String to File, but the problem still exist.

I thought at first that it had something to do with the File parameter
residing in a bean,
so I tried with both File (fileFile) and String (stringFile) directly.

Using Linux so paths should have slashes /.



bean (backslash \ exists after target):
[DEBUG]   (s) outputFile =
/home/jimisola/p4clients/lt/iso/main/product/common/target\generated-resources/buildinfo-java-common-1.4.0.0-SNAPSHOT.properties

File (<fileFile>slash/backslash\</fileFile>)

[DEBUG]   (f) fileFile =
/home/jimisola/p4clients/lt/iso/main/product/common/slash/backslash\

String (<stringFile>slash/backslash\</stringFile>):
[DEBUG]   (f) stringFile = slash/backslash\


Using File obviously replaced input (slash/backslash\) with the absolute
path, but backslashes are not replaced.

Am I missing out on something?  Should this be handled by Maven and
dependency injection mechanism (Plexus)?

Regards,
Jimisola
--
View this message in context: 
http://www.nabble.com/Using-Java-System-Properties-in-pom.xml-tf2161474.html#a6010105
Sent from the Maven - Users forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to