Re: A problem with pickfile? [message #6389 is a reply to message #6330] |
Tue, 18 June 1996 00:00   |
Tim Patterson
Messages: 65 Registered: October 1995
|
Member |
|
|
Julien Flack wrote:
> I had a little routine to do exactly the above (check for '/' or
> a '\' in the filename string). However, notice that under Motif
> it is possible to get a return filename something like: 'temp/'.
> Therefore, to find out if the returned file contains the path
> you must search for a separtor and make sure that the position
> of the separator is not equal to strlen()-1.
>
> I agree, this inconsistency, although not unsurmountable,
> is a little messy. It would be better if the convention was that
> the returned filename never included the path.
>
> --
> Julien.
Unfortunately, if you want to be platform independent, you also
need to check for VMS type directory structure too.
In the end, I used an idea that Phil Willams sent me to strip
out the path name if it existed in an OS independent way:
file = pickfile(get_path = path)
if strpos(file, path) eq 0 then $
file = strmid(file,strlen(path),strlen(file))
However, I put this into the PICKFILE.PRO code so that it
always returns just the file name, and I have to use the
GET_PATH if I need to know the directory path.
I would have liked to fix the widget so that it only copies the
file name into the text widget when selected from the file list,
but the code appeared to be built-in rather than a library
routine.
Tim
|
|
|