ooRexx - chopping up file paths/names

This is a discussion on ooRexx - chopping up file paths/names within the REXX forums in Programming Languages category; ooRexx 3.2.0 (6.02, 30 Oct 2007) under Win XP I've typically used code like the following to separate a leaf name from a preceding drive/path value. parse source . . execfulp /* eg: "C:\A\B C D\EF G.rex" */ lastbksl = lastpos("\",execfulp) /* eg: 11 */ execpath = substr(execfulp,1,lastbksl-1) /* eg: "C:\A\B C D" */ execname = substr(execfulp,lastbksl+1) /* eg: "EF G.rex" */ Is there anything to choose between that and using the BIF filespec() ? (I realise that filespec includes the \ at the end of the part portion whereas my code didn't.) Does filespec() do something sensible on non-Windows ...

Go Back   Application Development Forum > Programming Languages > REXX

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 07-04-2008, 05:21 PM
Jeremy Nicoll - news posts
Guest
 
Default ooRexx - chopping up file paths/names

ooRexx 3.2.0 (6.02, 30 Oct 2007) under Win XP

I've typically used code like the following to separate a leaf name from a
preceding drive/path value.

parse source . . execfulp /* eg: "C:\A\B C D\EF G.rex" */
lastbksl = lastpos("\",execfulp) /* eg: 11 */
execpath = substr(execfulp,1,lastbksl-1) /* eg: "C:\A\B C D" */
execname = substr(execfulp,lastbksl+1) /* eg: "EF G.rex" */

Is there anything to choose between that and using the BIF filespec() ?

(I realise that filespec includes the \ at the end of the part portion
whereas my code didn't.)

Does filespec() do something sensible on non-Windows platforms?


--
Jeremy C B Nicoll - my opinions are my own.
Reply With Quote
  #2  
Old 07-04-2008, 09:37 PM
Michael Lueck
Guest
 
Default Re: ooRexx - chopping up file paths/names

Jeremy Nicoll - news posts wrote:
> Is there anything to choose between that and using the BIF filespec() ?

....
> Does filespec() do something sensible on non-Windows platforms?


filespec() had some undesirable behavior, so I developed my own in the ObjectCUR class library, and before that the CUR function library. One was when it can not digest what it is asked to do, it
returns a string '0'.

For my implementation I also supported UNC as well as C:\foo

I have vague memories that filespec() was even worse behaved on Linux than Windows. I have forgotten exact details as I use our version in the ObjectCUR class library, and I made it behave
consistently between Linux/Windows handling both DOS, Linux, and UNC paths.

--
Michael Lueck
Lueck Data Systems
http://www.lueckdatasystems.com/
Reply With Quote
  #3  
Old 07-07-2008, 03:53 AM
mberg
Guest
 
Default Re: ooRexx - chopping up file paths/names

On 5 Jul., 03:37, Michael Lueck <mlu...@lueckdatasystems.com> wrote:
Hi Jeremy
what about this...

parse source . . execfulp
parse value execfulp~Reverse() with execname '\' execpath
execpath = execpath~Reverse()
execname = execname~Reverse()

.... Martin

Reply With Quote
  #4  
Old 07-07-2008, 06:16 PM
Shmuel (Seymour J.) Metz
Guest
 
Default Re: ooRexx - chopping up file paths/names

In <gemini.k3i3ba00h9cts00vc@wingsandbeaks.org.uk.inv alid>, on 07/04/2008
at 10:21 PM, Jeremy Nicoll - news posts
<jn.nntp.scrap001@wingsandbeaks.org.uk> said:

>Does filespec() do something sensible on non-Windows platforms?


Yes.

--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org

Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 08:25 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.