aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes How to understant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "How to understant "pathconvert"?" Watch "How to understant "pathconvert"?" New topic
Author

How to understant "pathconvert"?

Tom John
Greenhorn

Joined: Apr 15, 2002
Posts: 29
I have following code:

--------------------------------
<project name="Pegasus"default="compile" basedir=".">
...
<pathconverttargetos="windows"
property="win.basedir">
<path>
<pathelement path="${basedir}" />
</path>
<map from="${path.root}" to=""/>
</pathconvert>
....
-------------------------------------

1) Here I don't know what's "${basedir}"?
2) Seems like "${basedir}" including "${path.root}"?? (${path.root} means "/vobs" in a 3rd party's property file)
3) How can I understand this whole code?

Thanks in advance!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

basedir="." means set the basedir property to the directory containing your build.xml file at the point when you started Ant. Usually, you keep that file in the root of the project directory, so the basedir is the project directory.

In most cases, Java will accept filepaths normalized to the Unix format - meaning that you can (and should) use forward slashes in the directory separators. However, if you need a filepath in the native form of an OS (Windows, Unix or Mac) - say with the Windows backslashes - then you use the pathconvert feature to do that for you.


Customer surveys are for companies who didn't pay proper attention to begin with.
Tom John
Greenhorn

Joined: Apr 15, 2002
Posts: 29
Tim, thank you very much!

I'm still confused by the second question.

It tell me that if ${basedir}is begging with ${path.root}, then it will be replaced by "". Right?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

You've got me confused. "path.root" isn't one of the standard Ant or Java system properties - as I read it, you're saying that there's a third-party properties file that defines path.root.

In the example you've shown, the source for the path translation is $path.root. If path.root was defined as an absolute pathname, Ant will use that absolute pathname. If path.root was defined as a relative pathname, then the path will be relative to $basedir, as are all other relative path references in an Ant task. So for relative paths, from="${path.root}" and from="${basedir}/$(path.root}" would be equivalent.


I left off the curly brackets because I was too lazy to type them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to understant "pathconvert"?