Changeset 239 for trunk/SRC/Colors
- Timestamp:
- 03/28/07 08:50:03 (17 years ago)
- Location:
- trunk/SRC/Colors
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/lct.pro
r232 r239 43 43 ; definition of the name of the file containing colors palettes. 44 44 if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 45 ; What is the full address of nametbl? 46 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 47 CASE thisOS of 48 'MAC':BEGIN & sep = ':' & pathsep = ',' & end 49 'WIN':BEGIN & sep = '\' & pathsep = ';' & end 50 ELSE: BEGIN & sep = '/' & pathsep = ':' & end 51 ENDCASE 52 cd, current = current 53 if strpos(nametbl, sep) lt 0 then BEGIN 54 if rstrpos(current, sep) NE strlen(current)-1 then current = current+sep 55 multipath = str_sep(!path, pathsep) 56 for i = 0, n_elements(multipath)-1 do $ 57 if rstrpos(multipath[i], sep) NE strlen(multipath[i])-1 then $ 58 multipath[i] = multipath[i] +sep 59 nametbl = [current, multipath]+ nametbl 60 ENDIF 61 ; we test all possible name in order to find where file is. 62 nfile = n_elements(nametbl) 63 n = 0 64 repeat begin 65 res = findfile(nametbl[n]) 66 n = n+1 67 endrep until res[0] NE '' OR n EQ n_elements(nametbl) 68 if res[0] NE '' then BEGIN 69 nametbl = nametbl[n-1] 45 ; look for nametbl file 46 nametbl = (find(nametbl, /firstfound, /nopro))[0] 47 if nametbl NE 'NOT FOUND' then BEGIN 70 48 if n_elements(ex) NE 0 then $ 71 49 if (where(tag_names(ex) EQ 'FILE'))[0] NE -1 then ex.FILE = nametbl -
trunk/SRC/Colors/newpalette.pro
r238 r239 35 35 compile_opt idl2, strictarrsubs 36 36 ; 37 @cm_general 38 ; 39 homedir = isadirectory(homedir, title = 'select MyIDL directory') 37 40 ; definition of the name of the file containing colors palettes. 38 41 if keyword_set(file) then nametbl = file ELSE nametbl = 'palette.tbl' 39 ; What is the full adress of nametbl? 40 homedir = isadirectory(homedir, title = 'select MyIDL directory') 42 ; look for nametbl file 41 43 namesave = nametbl 42 nametbl = find(nametbl) 43 if nametbl[0] NE 'NOT FOUND' then begin 44 nametbl = nametbl[0] 45 nameshort = file_basename(nametbl) 46 ; is nametbl belongs to the same effective user ID (UID) as the IDL process? 47 IF !d.name EQ 'X' THEN BEGIN ; works only for unix tye machine 48 IF file_test(nametbl, /user) NE 1 THEN BEGIN 49 noanswer = report('The file '+nametbl+' is not yours... Do you want to copy '+nameshort+' in your MyIDL directory: '+homedir+' ?', /default_no, /question) 50 IF noanswer THEN return ELSE BEGIN 51 file_copy, nametbl, homedir ; copy the file 52 nametbl = homedir + nametbl ; update its name 53 ENDELSE 54 ENDIF 55 ENDIF 56 ; no file nametbl found 57 ENDIF ELSE BEGIN 44 nametbl = (find(nametbl, /firstfound, /nopro))[0] 45 ; no file nametbl found, do we create one? 46 if nametbl EQ 'NOT FOUND' then BEGIN 58 47 nametbl = file_basename(namesave) ; get back the original nametbl 59 noanswer = report('The file '+nametbl+' was not found !path directories... Do you want to create such a file in your MyIDL directory: '+homedir+' ?', /default_no, /question) 48 noanswer = report(['The file '+nametbl+' was not found !path directories.' $ 49 , 'Do you want to create such a file in your MyIDL directory: '+homedir+' ?'] $ 50 , /default_no, /question) 60 51 if NOT noanswer then return 61 52 nameorg = filepath('colors1.tbl', subdir = ['resource', 'colors']) 62 file_copy, nameorg, homedir 53 nametbl = homedir + file_basename(nametbl) ; update its name 54 file_copy, nameorg, nametbl ; copy the file 55 file_chmod, nametbl, /u_write ; make sure we have write access 56 ENDIF 57 ; do we have write access? 58 IF file_test(nametbl, /write) EQ 0 THEN BEGIN 59 noanswer = report(['You have no write access on file '+nametbl $ 60 , 'Do you want to copy '+nameshort+' in your MyIDL directory: '+homedir+' ?'] $ 61 , /default_no, /question) 62 IF noanswer THEN return ELSE BEGIN 63 nametbl = homedir + file_basename(nametbl) ; update its name 64 file_copy, nametbl, homedir, /allow_same ; copy the file 65 file_chmod, nametbl, /u_write ; make sure we have write access 63 66 ENDELSE 64 ; is nametbl writable? 65 IF file_test(nametbl, /write) NE 1 THEN file_chmod, nametbl, /u_write 67 ENDIF 66 68 ; make sure that we will really use nametbl name even if _EXTRA keyword is used 67 69 if n_elements(ex) NE 0 then $ -
trunk/SRC/Colors/xlct.pro
r237 r239 501 501 ;----------------------------------------------------------------------------- 502 502 IF N_ELEMENTS(file) GT 0 THEN filename = file ELSE BEGIN 503 filename = find('palette.tbl') 504 filename = filename[0] 503 filename = (find('palette.tbl', /firstfound, /nopro))[0] 505 504 if filename EQ 'NOT FOUND' then filename=filepath('colors1.tbl',subdir=['resource', 'colors']) 506 505 ENDELSE
Note: See TracChangeset
for help on using the changeset viewer.