comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: file_basename(): bug or feature?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: file_basename(): bug or feature? [message #42772 is a reply to message #42771] Thu, 24 February 2005 13:28 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Benjamin Hornberger writes:

> On Unix machines, IDL's file_basename() function doesn't split a path in
> Windows format (with backslashes). On Windows machines, it splits both
> (yes, I know, on Windows you can also use both to specify a path). Is
> this a bug or a feature?
>
> Linux:
>
> IDL> filename='d:\path\to\file.ex
> IDL> print,file_basename(filename)
> d:\path\to\file.ex
> IDL> filename='d:/path/to/file.ex'
> IDL> print,file_basename(filename)
> file.ex
>
> Windows:
>
> IDL> filename='d:\path\to\file.ex'
> IDL> print,file_basename(filename)
> file.ex
> IDL> filename='d:/path/to/file.ex'
> IDL> print,file_basename(filename)
> file.ex
>
> I have a situation where a Linux machine has to handle Windows paths,
> where this is quite annoying ...
>
> Any comments?

I'm not sure it's a bug OR a feature. More likely the
sensible way to write the program, given the original
purpose. :-)

My FSC_BASE_FILENAME program has the same problem,
simply because I use PATH_SEP to obtain the path
separator. I think it would be difficult to write
a generic routine to handle all types of path separators
properly, but you could probably write a pretty good
specific one if you were sure of the types of filenames
you would be getting. I guess FSC_BASE_FILENAME is as
good a place as any to start.

http://www.dfanning.com/programs/fsc_base_filename.pro

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: file_basename(): bug or feature?
Next Topic: /YNOZERO

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 02:26:24 PDT 2025

Total time taken to generate the page: 1.83780 seconds