function path_data, module, count, nopath=nopath, bydir=bydir, $ multi=multi, exact=exact ; common path_data_blk, psw_paths, psw_modules, psw_map ; nopro=1 ; set up common on first call if n_elements(psw_paths) eq 0 then begin ; 1st call, read generic file restgen,paths, modules, map, $ ; 3 vectors in file file=concat_dir('$DIR_SITE_SETUPD','datamap') ; .genx psw_paths=paths ; assign common psw_modules=modules psw_map=map endif ; ; Now do lookup outarr='' ; make a couple of mods to the input argument inmod=str_replace(module,'*','') ; in case wild card was passed if keyword_set(exact) and $ ; allow xxx.pro and xxx to not keyword_set(nopro) then inmod= $ ; both be exact matches str_replace(inmod,'.pro','') + '.pro' inmod=strtrim(inmod,2) ; ignore blanks ; ; since we use substrings here ; ; (but we may eventually ; ; want an exact match func) ; if keyword_set(bydir) then begin ; addded afer the fact so dirmatch=strpos(psw_paths,inmod) ; this logic is sloppy success=where(dirmatch ne -1,count) smap=[0] ; initialize success vector for i=0,count-1 do $ smap=[smap,where(psw_map eq success(i))] if count gt 0 then begin success=smap(1:*) count=n_elements(success) endif endif else begin ; 'standard' logic (match modules) if keyword_set(exact) then $ success=where(inmod eq psw_modules,count) $ else success=where(strpos(psw_modules,inmod)ne -1,count) endelse ; filter out directories/scripts, etc unless otherwise requested prosonly = not keyword_set(nopro) if prosonly and count gt 0 then begin pros=where(strpos(psw_modules(success),'.pro') ne -1 ,count) if count gt 0 then success=success(pros) endif ; ; strip out duplicates unless specifically requested if not keyword_set(multi) and count gt 0 then begin outarr=psw_modules(success) ;subarray to uniqify success=success(uniq(outarr,sort(outarr))) ;update subscripts count=n_elements(success) ;update output count endif ; success vector is fully established, now define the output format if count gt 0 then begin ; I am asking this way ; ; way too frequently outarr=psw_modules(success) ; module names if not keyword_set(nopath) then outarr= $ ; default adds path concat_dir(psw_paths(psw_map(success)),outarr ) endif return,outarr end