You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Douglas McCarroll <mc...@gmail.com> on 2007/04/20 22:16:49 UTC

What is $.. ?

Hi All,

I ran across "$.." in an Ant file and am trying to understand what it 
does. Can't find any documentation. So basic as to not require explanation?


When I run a C:\Projects\build.xml file with this code in it:

   <property name="projects.dir" value="$.." />
   <dirname property="projects.dirname" file="${projects.dir}"/>
   <dirname property="logfiledirname" file="${projects.dir}\AntLog.log"/>
  
   <echo message="${projects.dir}"/>
   <echo message="${projects.dirname}"/>
   <echo message="${projects.dir}\AntLog.log"/>
   <echo message="${logfiledirname}"/>


I get this:

     [echo] $..
     [echo] c:\Projects
     [echo] $..\AntLog.log
     [echo] c:\Projects\$..


The first three echoes would make sense to me if $.. indicated the 
current directory, but a single dot does that. What's the difference?

The fourth echo doesn't make sense to me at all...

Douglas



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: What is $.. ?

Posted by Vincent <vi...@gmail.com>.
And I think what might made you confuse is the dirname task.

Task to determine the directory path of a specified file.

When this task executes, it will set the specified property to the
value of the specified file (or directory) up to, but not including,
the last path element. If the specified file is a path that ends in a
filename, the filename will be dropped. If the specified file is just
a filename, the directory will be the current directory.


On 4/21/07, Vincent <vi...@gmail.com> wrote:
> You can try replace the first line to
> <property name="projects.dir" value="$aaa" /> then try it again.
>
> On 4/21/07, Douglas McCarroll <mc...@gmail.com> wrote:
> > Hi All,
> >
> > I ran across "$.." in an Ant file and am trying to understand what it
> > does. Can't find any documentation. So basic as to not require explanation?
> >
> >
> > When I run a C:\Projects\build.xml file with this code in it:
> >
> >   <property name="projects.dir" value="$.." />
> >   <dirname property="projects.dirname" file="${projects.dir}"/>
> >   <dirname property="logfiledirname" file="${projects.dir}\AntLog.log"/>
> >
> >   <echo message="${projects.dir}"/>
> >   <echo message="${projects.dirname}"/>
> >   <echo message="${projects.dir}\AntLog.log"/>
> >   <echo message="${logfiledirname}"/>
> >
> >
> > I get this:
> >
> >     [echo] $..
> >     [echo] c:\Projects
> >     [echo] $..\AntLog.log
> >     [echo] c:\Projects\$..
> >
> >
> > The first three echoes would make sense to me if $.. indicated the
> > current directory, but a single dot does that. What's the difference?
> >
> > The fourth echo doesn't make sense to me at all...
> >
> > Douglas
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: What is $.. ?

Posted by Douglas McCarroll <mc...@gmail.com>.
Vincent wrote:
> You can try replace the first line to
> <property name="projects.dir" value="$aaa" /> then try it again.


Thanks Vincent. I've tried your suggestion and the explanation seems 
fairly simple. "$.." is simply a string, nothing more.


Here's my understanding:


  <property name="projects.dir" value="$aaa" />
  <echo message="${projects.dir}"/>
     [echo] $aaa

So "$aaa" or "$.." are just string values?



  <echo message="${projects.dir}\AntLog.log"/>
     [echo] $aaa\AntLog.log

A simple string value would also explain this.



  <dirname property="projects.dirname" file="${projects.dir}"/>
  <echo message="${projects.dirname}"/>
     [echo] c:\_Projects

Ant is assuming that "$aaa" is a filename and giving me the current 
directory.



  <dirname property="logfiledirname" file="${projects.dir}\AntLog.log"/>
  <echo message="${logfiledirname}"/>
     [echo] c:\_Projects\$aaa

Here Ant assumes that I'm specifying [CurrrentDirectory]\$aaa\AntLog.log 
and returns the file's directory path.


Seems pretty straightforward. Let me know if any of this is wrong.

Now I'll go back and look at the file where I first found $.., and see 
if I can figure out what they were doing.  :-)

Thanks again!



>
> On 4/21/07, Douglas McCarroll <mc...@gmail.com> wrote:
>> Hi All,
>>
>> I ran across "$.." in an Ant file and am trying to understand what it
>> does. Can't find any documentation. So basic as to not require 
>> explanation?
>>
>>
>> When I run a C:\Projects\build.xml file with this code in it:
>>
>>   <property name="projects.dir" value="$.." />
>>   <dirname property="projects.dirname" file="${projects.dir}"/>
>>   <dirname property="logfiledirname" file="${projects.dir}\AntLog.log"/>
>>
>>   <echo message="${projects.dir}"/>
>>   <echo message="${projects.dirname}"/>
>>   <echo message="${projects.dir}\AntLog.log"/>
>>   <echo message="${logfiledirname}"/>
>>
>>
>> I get this:
>>
>>     [echo] $..
>>     [echo] c:\Projects
>>     [echo] $..\AntLog.log
>>     [echo] c:\Projects\$..
>>
>>
>> The first three echoes would make sense to me if $.. indicated the
>> current directory, but a single dot does that. What's the difference?
>>
>> The fourth echo doesn't make sense to me at all...
>>
>> Douglas
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: What is $.. ?

Posted by Vincent <vi...@gmail.com>.
You can try replace the first line to
<property name="projects.dir" value="$aaa" /> then try it again.

On 4/21/07, Douglas McCarroll <mc...@gmail.com> wrote:
> Hi All,
>
> I ran across "$.." in an Ant file and am trying to understand what it
> does. Can't find any documentation. So basic as to not require explanation?
>
>
> When I run a C:\Projects\build.xml file with this code in it:
>
>   <property name="projects.dir" value="$.." />
>   <dirname property="projects.dirname" file="${projects.dir}"/>
>   <dirname property="logfiledirname" file="${projects.dir}\AntLog.log"/>
>
>   <echo message="${projects.dir}"/>
>   <echo message="${projects.dirname}"/>
>   <echo message="${projects.dir}\AntLog.log"/>
>   <echo message="${logfiledirname}"/>
>
>
> I get this:
>
>     [echo] $..
>     [echo] c:\Projects
>     [echo] $..\AntLog.log
>     [echo] c:\Projects\$..
>
>
> The first three echoes would make sense to me if $.. indicated the
> current directory, but a single dot does that. What's the difference?
>
> The fourth echo doesn't make sense to me at all...
>
> Douglas
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org