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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Mark directory for exclusion from !PATH [message #38125] Mon, 23 February 2004 08:23
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Sun, 22 Feb 2004 16:11:29 -0800, Andrew Cool wrote:

> JD Smith <jdsmith@as.arizona.edu> wrote in message news:<pan.2004.02.20.23.58.16.472234@as.arizona.edu>...
>> On Fri, 20 Feb 2004 17:00:58 -0500, Wayne Landsman wrote:
>>
>>> JD Smith wrote:
>> 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,
>
> Under Windows (IDL v6.0) at least, dirs=strsplit(!PATH,':',/EXTRACT) returns
> directory strings in this format :- \IDL\ZZZ_camdemo\;C
> whereas using a semi-colon to split the Path returns :-
> C:\IDL\ZZZ_camdemo\, which works a whole lot better ... ;-)
>
> The STRJOIN could do with a ';' too.

Aha... I guess all the C: stuff does mess it up. Here's a portable
version (I hope). I've been using the 'IDL_IGNORE' file method for a
few days, and I really like it. Perhaps RSI will pick up on the
concept and build it into their path search.

JD

pro prune_idl_ignore,RECURSIVE=rcrsv,VERBOSE=vb
dirs=strsplit(!PATH,path_sep(/SEARCH_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 keyword_set(vb) then begin
bad=where(sweep,nbad)
print,'Pruning ',strtrim(nbad,2),' !PATH dirs:'
if nbad gt 0 then print,' '+dirs[bad]
endif
if ngood eq 0 then return
!PATH=strjoin(dirs[good],path_sep(/SEARCH_PATH))
end
Re: Mark directory for exclusion from !PATH [message #38142 is a reply to message #38125] Sun, 22 February 2004 16:11 Go to previous message
andrew.cool is currently offline  andrew.cool
Messages: 47
Registered: July 2003
Member
JD Smith <jdsmith@as.arizona.edu> wrote in message news:<pan.2004.02.20.23.58.16.472234@as.arizona.edu>...
> On Fri, 20 Feb 2004 17:00:58 -0500, Wayne Landsman wrote:
>
>> JD Smith wrote:
> 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

JD,

Under Windows (IDL v6.0) at least, dirs=strsplit(!PATH,':',/EXTRACT) returns
directory strings in this format :- \IDL\ZZZ_camdemo\;C
whereas using a semi-colon to split the Path returns :-
C:\IDL\ZZZ_camdemo\, which works a whole lot better ... ;-)

The STRJOIN could do with a ';' too.

Andrew
Re: Mark directory for exclusion from !PATH [message #38152 is a reply to message #38142] Fri, 20 February 2004 15:58 Go 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
Re: Mark directory for exclusion from !PATH [message #38154 is a reply to message #38152] Fri, 20 February 2004 14:00 Go to previous message
Wayne Landsman is currently offline  Wayne Landsman
Messages: 117
Registered: January 1997
Senior Member
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.

--Wayne Landsman
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: String composition
Next Topic: Re: Array string

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

Current Time: Wed Oct 08 13:36:34 PDT 2025

Total time taken to generate the page: 0.00386 seconds