Hi Rony,
The confusion arises with the very first phrase "Returns the current
directory".
If your working directory is 'c:\old_Directory' and both that and
'c:\new_directory' exist
then I would expect
pwd = directory('c:\new_directory')
to set pwd to 'c:\old_Directory', not 'c:\new_directory'
I hope that clarifies things a bit.
Jon
On 3 February 2016 at 13:28, Rony G. Flatscher <rony.flatsc...@wu.ac.at>
wrote:
> Hi there,
>
> not being an English native speaker the text seems to be very clear! :-)
>
> Here a rexxtry-session on a German Windows with all three usages:
>
> D:\Dokumente und Einstellungen\Administrator>rexxtry
> REXX-ooRexx_4.2.1(MT)_32-bit 6.04 15 Sep 2015
> rexxtry.rex lets you interactively try REXX statements.
> Each string is executed when you hit Enter.
> Enter 'call tell' for a description of the features.
> Go on - try a few... Enter 'exit' to end.*dir=directory()**;say
> "["dir"]"**[D:\Dokumente und Einstellungen\Administrator]*
> ........................................... rexxtry.rex on
> WindowsNT*dir=directory("directory_that_does_not_exist")**;say "["dir"]"**[]*
> ........................................... rexxtry.rex on
> WindowsNT*dir=directory("d:\Dokumente und Einstellungen");**say
> "["dir"]"**[d:\Dokumente und Einstellungen]*
> ........................................... rexxtry.rex on WindowsNT
> exit
>
>
> - The first usage returns the current directory,
> - the second usage supplies a non-existing-directory, which causes an
> empty string to be returned, indicating that no change of the current
> directory took place,
> - the third usage supplies an existing directory, to which a switch
> occurs, returning the now (new) current directory.
>
> HTH,
>
> ---rony
>
>
>
> On 02.02.2016 23:10, Jon Wolfers wrote:
>
> Hi Bertram,
>
> Yes, this looks like a bug of some sort. The manual I have gives the
> description as you quote, but then the example that follows immediately
> after clearly does not expect the same behaviour.
>
> I would say that this is a documentation bug as the documentation lists
> two different behaviours which can't both be right, and the code only
> displays one of these behaviours.
>
> FWIW, I have been using this function wrongly for over a decade and for
> some unfathomable reason it has not yet caused a problem. This is probably
> because I set (& then ineffectively pop) the directory wherever it is
> critical.
>
> Unless anyone has further wisdom on this one of us should raise a bug
> report.
>
> Jon
>
> On 2 February 2016 at 21:44, Bertram Moshier <bertrammosh...@gmail.com>
> wrote:
>
>> Hi,
>>
>> I'm confused about the directory function both in its usage and
>> documentation.
>>
>> The documentation reads:
>>
>> Returns the current directory, changing it to *newdirectory* if an
>>> argument is supplied and the named directory exists. If *newdirectory* is
>>> not specified, the name of the current directory is returned. Otherwise, an
>>> attempt is made to change to the specified *newdirectory*. If
>>> successful, the name of the *newdirectory* is returned; if an error
>>> occurred, null is returned.
>>>
>>
>> The opening sentence looks to be clear. The directory function will:
>>
>> 1. Obtain the current directory and
>> 2. Change to a new directory (assuming it exist).
>>
>> The second sentence is also clear. If you don't include an argument,
>> you'll get the name of the current directory and no attempt to change to a
>> new directory will occur.
>>
>> What I don't understand are the last two sentences and how they relate to
>> the first two sentences. They seem in conflict.
>>
>> "Otherwise" OK, otherwise to not having an argument (e.g. new
>> directory), sure, it is what occurs in the opening sentence IF the
>> directory exists.
>>
>>
>> *All right, instead of analyzing the documentation maybe a simpler way to
>> ask/say all this is:*
>>
>> *HOW DO I GET THE DIRECTORY FUNCTION TO OPERATE AS DESCRIBED IN THE
>> OPENING SENTENCE? The given is the directory specified by newdirectory
>> does exists.*
>>
>>
>> Basically what I would like is to code:
>>
>> Current_Directory = directory(New_Directory)
>>
>> and when New_Directory exists I get the Current Directory, if the New
>> Directory doesn't exists I get null.
>>
>> It is how I read the opening sentence to the Directory function.
>>
>> What I am seeing though, is either the new directory or null and never
>> the current directory, as described in the opening sentence.
>>
>>
>>
>>
>> What am I trying to do is write a very simple function to:
>>
>> 1. State (like FSSTATE in CMS) the existence of a directory (new
>> directory).
>> 2. If it exists, cool, return and depending upon arguments leave the
>> directory as either the new directory or the caller's current directory.
>> 3. If it does not exist, then make the new directory, return, and
>> like #2 leave the directory per arguments.
>>
>>
>>
>> *Yes, I can code based upon the behavior I'm seeing, but I'd like to
>> understand how to get Rexx to behave as described in the opening sentence,
>> PLEASE and Thank You.*
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> _______________________________________________
>> Oorexx-users mailing list
>> Oorexx-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup
> Now!http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>
>
>
> _______________________________________________
> Oorexx-users mailing
> listOorexx-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
> --
> --
> __________________________________________________________________________________
>
> Prof. Dr. Rony G. Flatscher
> Department Informationsverarbeitung und Prozessmanagement
> Institut für Betriebswirtschaftslehre und Wirtschaftsinformatik
> D2-C 2.086
> WU Wien
> Welthandelsplatz 1
> A-1020 Wien/Vienna, Austria/Europe
> http://www.wu.ac.at
> __________________________________________________________________________________
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users