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

Home » Public Forums » archive » Re: Mark directory for exclusion from !PATH
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: Mark directory for exclusion from !PATH [message #38152 is a reply to message #38142] Fri, 20 February 2004 15:58 Go to previous messageGo to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Fri, 20 Feb 2004 17:00:58 -0500, Wayne Landsman wrote:

> JD Smith wrote:
>> Is their
>> an equivalent way to mark a directory so that it is not included in
>> !PATH at all? Something like "IDL_IGNORE" or some such comes to mind,
>> but I haven't found a mention of it.
>
> This reminds me of a frustrating experience I had last week when IDL
> would hang after I added a large directory structure to the !PATH. It
> turns out that there was a bad logical directory link that was putting
> IDL into an infinite loop trying to resolve the subdirectories. I only
> solved the problem after switching back to V5.5 which gave explicit
> error messages -- unlike V6.0 which would hang silently.
>
> As for your original question, I can only think of the crude method of
> explicitly removing directory names from a string created using
> EXPAND_PATH before adding it to your !PATH, e.g. to remove the directory
> /home/landsman/pro/bte from the list of directories in
> +/home/landsman/pro in your startup file
>
> st = expand_path('+/home/landsman/pro')
> st = repstr(st,'/home/landsman/pro/bte:)
> !path = st + ':' + !path
>
> where repstr.pro (ftp://idlastro.gsfc.nasa.gov/pub/pro/misc/repstr.pro)
> removes the target string from object string.

I just whipped up a little routine to let me mark directories which
contain a file IDL_IGNORE. These directories, and, optionally, all
their subdirectories, are then removed from the !PATH. I call it at
startup and it works a treat. Now I can just keep everything in
~/idl, make !PATH start with +~/idl, and mark and unmark directories
with a simple file: no more futzing with !PATH.

JD

pro prune_idl_ignore,RECURSIVE=rcrsv
dirs=strsplit(!PATH,':',/EXTRACT)
sweep=file_test(dirs+path_sep()+'IDL_IGNORE',/REGULAR)
if keyword_set(rcrsv) then begin
wh=where(sweep,cnt)
if cnt gt 0 then begin
for i=0,cnt-1 do begin
wh_root=where(strpos(dirs,dirs[wh[i]]) eq 0,root_cnt)
if root_cnt gt 0 then sweep[wh_root]=1b
endfor
endif
endif
good=where(sweep eq 0,ngood)
if ngood eq 0 then return
!PATH=strjoin(dirs[good],':')
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: String composition
Next Topic: Re: Array string

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

Current Time: Fri Oct 10 21:54:06 PDT 2025

Total time taken to generate the page: 0.08129 seconds