| Re: cd bug in IDL 5.5 [message #31087 is a reply to message #31068] |
Tue, 18 June 2002 00:02   |
R.Bauer
Messages: 1424 Registered: November 1998
|
Senior Member |
|
|
Ben wrote:
>
>> another, perhaps, bug i have discovered is that the file_expand_path
>> expands from the current working directory (not very handy :x ), not the
>> actual directory where the file might be. It should issue a warning if that
>> file does not exist in the current directory, something like:
>
> I too have noticed that file_expand_path doesn't work the way you
> would hope
> it would. As a solution I wrote my own "search" program that looks for
> a file
> and returns the full path to it. It will look outside of the working
> directory. It returns an array of all paths fitting 'filename'. It's
> probably not perfect but it works.
>
> Hope this helps,
>
> Ben Hilldore
> Hope College Nuclear Research Group
>
> function getFilePath, filename
> dirs = expand_path('+c:\', /all_dirs, /array)
> filenames = strarr(n_elements(dirs))
> for i = 0,n_elements(dirs)-1 do begin
> filenames[i] = findfile(dirs[i] + '\' + filename)
> endfor
> return, filenames[where(strlen(filenames) gt 1)]
> end
Dear Ben,
it could be easier to use file_which
x=file_which('mean.pro')
print,x
/usr/local/idl/idl/lib/mean.pro
fpe=file_path_name_ext(x)
print,fpe.path
/usr/local/idl/idl/lib/
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_source/idl _html/dbase/download/file_path_name_ext.tar.gz
For further routines and licensing please have a look at
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
regards
Reimar
--
Reimar Bauer
Institut fuer Stratosphaerische Chemie (ICG-I)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
------------------------------------------------------------ -------
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
============================================================ =======
|
|
|
|