| Re: Need advice on building a project [message #40027 is a reply to message #33270] |
Sun, 04 July 2004 01:59   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Fri, 02 Jul 2004 22:26:00 -0700, David Fanning wrote:
> Robbie Barnet writes:
>
>> I didn't realise that IDL searched subdirectories, I was *told* that it
>> didn't do that. I'll have to look into what versions of IDL support
>> this.
>
> My first experience with IDL was with IDL 1.0, and I'm pretty sure
> *that* one searched sub-directories. :-)
>
>> Even though, I still have problems with stupid code which doesn't keep
>> the filename and procedure name the same.
>
> People who write code like this should be taken out back and shot.
> (Apologies to many of my friends.)
>
>> I'm also conerned with
>> accidently having two files with the same name in a different
>> directory. Imagine two indepenant applications in your idl directory
>> which use different versions of the same file. The only way around this
>> is to move applications in and out of your idl directory.
>
> Well, another way around this, frequently employed, as I understand it,
> is to rename one of the files. :-)
I've lately resorted to a little program that runs at startup and
looks for a file "IDL_IGNORE" in any of the directories on the search
path, and then prunes those from the path. This is very useful when
you want to quickly eliminate a file from consideration.
------------------------
pro prune_idl_ignore,RECURSIVE=rcrsv,VERBOSE=vb
dirs=strsplit(!PATH,path_sep(/SEARCH_PATH),/EXTRACT)
ps=path_sep()
sweep=file_test(dirs+ps+'IDL_IGNORE',/REGULAR)
good=where(sweep eq 0,ngood)
if ngood eq 0 then return
if keyword_set(rcrsv) then begin
for i=0,ngood-1 do begin
root=dirs[good[i]]
repeat begin
pos=strpos(root,ps,/REVERSE_SEARCH)
if pos ne -1 then root=strmid(root,0,pos)
endrep until pos eq -1 || file_test(root+ps+'IDL_IGNORE',/REGULAR)
if pos ne -1 then sweep[good[i]]=1
endfor
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,' '+transpose(dirs[bad])
endif
if ngood eq 0 then return
!PATH=strjoin(dirs[good],path_sep(/SEARCH_PATH))
end
|
|
|
|