pro open_file_dialog, was_dot_sav=was_dot_sav @common_blocks.inc saved_dir = data_dir file_list = '' ; in case the current directory is from squirrel or such which ends in .dir ; do list files one level up rather than same directory again if ((strmatch(data_dir, '*.dir/') ne 0) || (strmatch(data_dir, '*/DD0*/') ne 0)) then $ newp=data_dir+'../' else newp = data_dir was_dat_sav = 0 old_file = file_name file_name = dialog_pickfile(FILTER = '*.hierarchy;*.mhierarchy;*P000.hdf5.idx;*.sav;*.a5;*.speck;snapshot_*', $ Path=newp, DIALOG_PARENT=BASE2, $ TITLE = 'select hierarchy files, movie files, ' + $ 'directories containing them or saved states.', $ GET_PATH = data_dir, /NOCONFIRM, $ /MULTIPLE_FILES, /READ) slash_is_at = StrPos(file_name, '/',/reverse_search) print, file_name if (file_name[0] eq '') then data_dir = saved_dir else begin IF (strlen(file_name[0])-1 eq slash_is_at[0]) THEN BEGIN ; directory? ; find all hierarchy file in subdirectories print,'Finding all hierarchy files in ', file_name new_file_list = FILE_SEARCH(file_name[0]+['*.hierarchy', '*/*.hierarchy']); , /TEST_REGULAR) if verbose then print, 'found :', N_elements(new_file_list) if (N_elements(new_file_list) gt 10) then file_list=new_file_list $ else file_list= [file_list, new_file_list[*]] indeces = indgen(N_ELEMENTS(file_list)) ind = sort(file_list) file_list = file_list[ind] END ELSE BEGIN ; individual file ? if (N_elements(file_name) eq 1) then begin if (strmatch(file_name,'*.sav') ne 0) then begin load_state, file_name[0] was_dot_sav = 1 return endif if ((strmatch(file_name,'*.hierarchy') ne 0) or $ (strmatch(file_name,'*.h5') ne 0) or $ (strmatch(file_name,'*.a5') ne 0) or $ (strmatch(file_name,'*.hdf5.idx') ne 0) or $ (strmatch(file_name,'*.speck') ne 0) or $ (strmatch(file_name,'*snapshot_*') ne 0)) then begin file_list = [file_name] endif if (strmatch(file_name,'*.mhierarchy') eq 1) then begin file_list = read_ascii_file_return_list_of_strings( $ file_name, verbose=verbose, nlines=nlines) file_list=file_list[sort(file_list)] if verbose then print, 'found ', N_elements(file_list), ' potential files.' endif end else if N_elements(file_name) gt 1 then file_list = file_name ENDELSE ind = where(file_test(file_list, /READ) ne 0) if (ind[0] ne -1) then begin file_list = file_list[ind] if verbose then print, 'found ', N_elements(file_list), ' readable files.' file_name = file_list[N_elements(file_list)-1] end else begin print, 'none of the files is readable ...' file_name=old_file a = breaki endelse file_name = file_name[0] ; make sure it is a single string END END