Jeremy,

it is a problem with "samples\makestring.rex".

Running it on a Windows 7 machine yields:

    C:\Program Files (x86)\ooRexx\samples>*makestring.rex*
    Unable to create test file :  
C:\Users\ADMINI~1\AppData\Local\Temp\C:\Program Files 
(x86)\ooRexx\samples\tst_input.528

So the user's temporary directory location gets concatenated with the fully 
qualified path to the
temporary file.

The Rexx code up to that point looks like (starting with line # 62 after the 
comments and the
routine starting at line # 225):

    --creating temporary input and output file

    *file_name_in = getTempFileName('tst_input.???')*
    file_name_out = getTempFileName('tst_output.???')
    file_in = .stream~new(file_name_in)
    file_out = .stream~new(file_name_out)

    if file_in~open \= "READY:" then do
        say "Unable to create test file : " file_name_in
        exit
    end

    ... cut ...

    ::routine getTempFileName
      use strict arg template

      fileName = SysTempFileName(template)
      parse upper source os .

      -- Add code for other operating systems here if needed.
      select
        when os~abbrev(WIN) then do
          tempDir = value("TEMP", , "ENVIRONMENT")
          if tempDir == "" then tempDir = value("TMP", , "ENVIRONMENT")
          if tempDir == "" then leave  -- Give up.

          if tempDir~right(1) \== '\' then tempDir = tempDir'\'
          fileName = tempDir || fileName
        end
        otherwise
          nop
      end

    return fileName

SysTempFileName() returns a fully qualified path to the temporary file which 
gets appended to the
temporary directory on Windows only.

Removing the entire select statement (looks awkward anyway as only one 
WHEN-branch is there) solves
the problem on Windows.

---rony


On 02.10.2019 11:59, Jeremy Nicoll wrote:
> On Tue, 1 Oct 2019, at 22:02, P.O. Jonsson wrote:
>
>> Launching makestring.rex from the home directory (if that what it is 
>> called on Win) works
> C:\Users
>
> isn't a home directory.  Indeed it's not a usual place for a Windows user
> to be at all.  If a user is in that sort of place you'd expect them to be 
> looking at their own files eg at 
>
> C:\Users\myusername
>
>
>> But launching it from anywhere else fails:
>>
>> C:\>rexx makestring.rex
>> Unable to create test file : C:\Users\po\AppData\Local\Temp\C:\tst_input.954
> You've got two complete filenames concatenated there.
>
> The "C:\tst_input.954"  part is not valid on the end of the earlier bit, 
> because ":"
> is only valid as the second character of a filepath, immediately after a disk 
> letter.

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to