Changeset 152 for trunk/SRC/Utilities


Ignore:
Timestamp:
08/10/06 09:01:35 (18 years ago)
Author:
smasson
Message:

introduce pltv.pro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Utilities/find.pro

    r136 r152  
    2424; activate this keyword to stop looking for the file as soon as we found one. 
    2525; 
    26 ; @keyword IODIRECTORY {default=!path}  
     26; @keyword IODIRECTORY {default=['.',!path]}  
    2727; A scalar or array variable of string type, containing 
    2828; directories names where we are looking for the file. 
     
    3434; 
    3535; @keyword LOOKALLDIR  
    36 ; activate to look for the file with a recursive search 
    37 ; in iodir, homedir, !path + the DATA:TestsData directory if it exists. 
     36; activate to look for the file (with a recursive search if needed) 
     37; in . iodir, homedir, !path + the DATA:TestsData directory if it exists. 
    3838; 
    3939; @keyword NOPRO  
     
    5656; @keyword UNIQUE  
    5757; activate to make sure that each element of the output vector is unique. 
     58; 
     59; @keyword TRYFIND  
     60; if the file was not found and this keyword is activated, find will call 
     61; itself with the keywords /LOOKALLDIR and /FIRSTFOUND to try to find 
     62; the file we are looking for. Note that if the file was found at the 
     63; first try this keyword as no effect (which is not the case with LOOKALLDIR)  
    5864; 
    5965; @keyword _EXTRA  
     
    106112               , REPERTOIRE = repertoire, NOPRO = nopro, ONLYPRO = onlypro $ 
    107113               , ONLYNC = onlync, UNIQUE = unique, FIRSTFOUND = firstfound $ 
    108                , LOOKALLDIR = LOOKALLDIR, _extra = ex 
     114               , LOOKALLDIR = LOOKALLDIR, TRYFIND = tryfind, _extra = ex 
    109115; define where we look for the file 
    110116; 
     
    114120    keyword_set(lookalldir):BEGIN 
    115121@cm_general 
    116       dirnames = [iodir, homedir, !path] 
     122      dirnames = ['./', iodir, homedir, !path] 
    117123      tstdtadir= file_dirname(find('find', /onlypro), /mark_directory) 
    118124      tstdtadir = (file_search(tstdtadir+'../../DATA/TestsData'))[0] 
     
    121127    keyword_set(iodirectory): dirnames = iodirectory 
    122128    keyword_set(repertoire): dirnames = repertoire 
    123     ELSE: dirnames = !path 
     129    ELSE: dirnames = ['./', !path] 
    124130  ENDCASE 
    125131  tmp = dirnames 
     
    164170    ENDIF 
    165171  ENDFOR 
     172 
    166173  IF n_elements(fileout) EQ 1 THEN fileout = 'NOT FOUND' $ 
    167174  ELSE fileout = fileout[1:*] 
     
    171178  ENDIF ELSE fileout = fileout[0] 
    172179; 
     180  IF keyword_set(lookalldir) AND fileout[0] EQ 'NOT FOUND' $ 
     181     AND NOT keyword_set(recursive) THEN $ 
     182        filout = find(file_basename(filein[0]), /lookalldir $ 
     183                      , /recursive, _extra = ex) 
     184; 
     185  IF keyword_set(tryfind) AND fileout[0] EQ 'NOT FOUND' THEN BEGIN 
     186    fileout = find(file_basename(filein[0]), /lookalldir, /firstfound, _extra = ex) 
     187    fileout = fileout[0] 
     188  ENDIF 
     189; 
    173190  RETURN, fileout 
    174191END 
Note: See TracChangeset for help on using the changeset viewer.