source: trunk/SRC/Utilities/xfile.pro @ 134

Last change on this file since 134 was 134, checked in by navarro, 18 years ago

change *.pro file properties (del eof-style, del executable, set keywords Id

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; display in a widget an ASCII file.
8; It is the same thing that xdisplaydife but here, we use it
9; to display the content of a procedure or of a function,
10; even if it is not in the current directory (thanks to the path).
11;
12; @categories utilities
13;
14; @param filename {in}{required} It is the name of the procedure or of the function
15;                    we want to display (with or without .pro at the end).
16;
17; @keyword _extra used to pass your keywords
18;
19; @examples xfile,'plt'
20;
21; @history Sebastien Masson (smasson@lodyc.jussieu.fr)
22;                       7/1/99
23;                       6/7/1999: compatibilite mac et windows
24;
25; @version $Id$
26;
27;-
28;------------------------------------------------------------
29;------------------------------------------------------------
30;------------------------------------------------------------
31PRO xfile, filename, _extra = ex
32;
33  compile_opt idl2, strictarrsubs
34;
35pfile = strlowcase(filename)
36;
37; we have to find the full name.
38;
39   if strpos(pfile,".pro") lt 0 then pfile=pfile+".pro"
40   thisOS = strupcase(strmid(!version.os_family, 0, 3))
41   CASE thisOS of
42      'MAC':BEGIN & sep = ':' & pathsep = ',' & end
43      'WIN':BEGIN & sep = '\' & pathsep = ';' & end
44      ELSE: BEGIN & sep = '/' & pathsep = ':' & end
45   ENDCASE
46   cd, current = current
47   if strpos(pfile,sep) lt 0 then BEGIN
48      if rstrpos(current,sep) NE strlen(current)-1 then current = current+sep
49      multipath = str_sep(!path,pathsep)
50      if rstrpos(multipath[0],sep) NE strlen(multipath[0])-1 then multipath = multipath +sep
51      pfile = [current, multipath]+ pfile
52   ENDIF
53   i = 0
54   repeat begin
55      res = findfile(pfile[i])
56      i = i+1
57   endrep until res[0] NE '' OR i EQ n_elements(pfile)
58   if res[0] NE  '' then BEGIN
59; we open the file in a widget
60   xdisplayfile, pfile[i-1], _extra = ex
61   ENDIF ELSE ras = report('le fichier demande n''existe pas...')
62;
63;
64   return
65end
Note: See TracBrowser for help on using the repository browser.