Changeset 317 for trunk/SRC/Utilities


Ignore:
Timestamp:
12/03/07 15:20:41 (17 years ago)
Author:
smasson
Message:

check possible errors related to wrong path definition

File:
1 edited

Legend:

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

    r311 r317  
    4040; add it to !path 
    4141    !path = myuniquetmpdir + path_sep(/search_path) + !path 
     42; check that each element of !path is unique 
     43    splpath = strsplit(!path, path_sep(/search_path), /extract, count = ndir) 
     44    nouniq = different(lindgen(ndir), uniq(splpath, sort(splpath))) 
     45    IF nouniq[0] NE -1 THEN BEGIN 
     46      allpro = find('*.pro', iodirectory = !path, /onlypro) 
     47      nall = n_elements(allpro)  
     48      allpro = strmid(allpro, reform(strpos(allpro, '/', /reverse_search), 1, nall)+1) 
     49      nouniqpro = different(lindgen(nall), uniq(allpro, sort(allpro))) 
     50      IF nouniqpro[0] NE -1 THEN BEGIN  
     51        nouniqcnt = n_elements(nouniq) 
     52        nouniqprocnt = n_elements(nouniqpro) 
     53        text = ['', '   --- WARNING ---' $ 
     54                , 'Your !path contains '+strtrim(nouniqcnt, 1)+' duplicate elements' $ 
     55                , 'This can create bugs for files with the same name located in several directories ('+strtrim(nouniqprocnt, 1)+' found)'] 
     56        dummy = report(text) 
     57        text = ['', 'duplicate directories in the path:', splpath[nouniq[0:9 <(nouniqcnt-1)]]] 
     58        IF nouniqcnt GT 10 THEN text = [text, '...'] 
     59        dummy = report(text, /simple) 
     60        text = ['', 'files with the same name:', allpro[nouniqpro[0:9 <(nouniqprocnt-1)]]] 
     61        IF nouniqprocnt GT 10 THEN text = [text, '...', ''] 
     62        dummy = report(text, /simple) 
     63      ENDIF 
     64    ENDIF 
    4265  ENDIF 
    4366; 
Note: See TracChangeset for help on using the changeset viewer.