1Filename(3)                      OCaml library                     Filename(3)
2
3
4

NAME

6       Filename - Operations on file names.
7

Module

9       Module   Filename
10

Documentation

12       Module Filename
13        : sig end
14
15
16       Operations on file names.
17
18
19
20
21
22
23
24       val current_dir_name : string
25
26       The conventional name for the current directory (e.g.  .  in Unix).
27
28
29
30
31       val parent_dir_name : string
32
33       The conventional name for the parent of the current directory (e.g.  ..
34       in Unix).
35
36
37
38
39       val concat : string -> string -> string
40
41
42       concat dir file returns a file name that designates file file in direc‐
43       tory dir .
44
45
46
47
48       val is_relative : string -> bool
49
50       Return  true  if  the  file  name is relative to the current directory,
51       false if it is absolute (i.e. in Unix, starts with / ).
52
53
54
55
56       val is_implicit : string -> bool
57
58       Return true if the file name is relative and does  not  start  with  an
59       explicit reference to the current directory ( ./ or ../ in Unix), false
60       if it starts with an explicit reference to the root  directory  or  the
61       current directory.
62
63
64
65
66       val check_suffix : string -> string -> bool
67
68
69       check_suffix  name suff returns true if the filename name ends with the
70       suffix suff .
71
72
73
74
75       val chop_suffix : string -> string -> string
76
77
78       chop_suffix name suff removes the suffix suff from the filename name  .
79       The behavior is undefined if name does not end with the suffix suff .
80
81
82
83
84       val chop_extension : string -> string
85
86       Return  the given file name without its extension. The extension is the
87       shortest suffix starting with a period and not  including  a  directory
88       separator, .xyz for instance.
89
90       Raise Invalid_argument if the given name does not contain an extension.
91
92
93
94
95       val basename : string -> string
96
97       Split  a  file  name  into  directory  name  /  base file name.  concat
98       (dirname name) (basename name) returns a file name which is  equivalent
99       to name . Moreover, after setting the current directory to dirname name
100       (with Sys.chdir ), references to basename name  (which  is  a  relative
101       file name) designate the same file as name before the call to Sys.chdir
102       .
103
104       The result is not specified if the argument is not a  valid  file  name
105       (for example, under Unix if there is a NUL character in the string).
106
107
108
109
110       val dirname : string -> string
111
112       See Filename.basename .
113
114
115
116
117       val temp_file : string -> string -> string
118
119
120       temp_file  prefix  suffix returns the name of a fresh temporary file in
121       the temporary directory.  The base name of the temporary file is formed
122       by  concatenating  prefix , then a suitably chosen integer number, then
123       suffix .  The temporary file is created empty, with  permissions  0o600
124       (readable and writable only by the file owner).  The file is guaranteed
125       to be different from any other file that  existed  when  temp_file  was
126       called.
127
128
129
130
131       val  open_temp_file  :  ?mode:Pervasives.open_flag  list  ->  string ->
132       string -> string * Pervasives.out_channel
133
134       Same as Filename.temp_file , but returns both the name of a fresh  tem‐
135       porary  file,  and  an output channel opened (atomically) on this file.
136       This function is more secure than temp_file : there is no risk that the
137       temporary  file  will  be  modified  (e.g. replaced by a symbolic link)
138       before the program opens it.  The optional argument mode is a  list  of
139       additional  flags  to  control the opening of the file.  It can contain
140       one or several of Open_append , Open_binary  ,  and  Open_text  .   The
141       default is [Open_text] (open in text mode).
142
143
144
145
146       val temp_dir_name : string
147
148       The  name  of  the  temporary  directory:  Under Unix, the value of the
149       TMPDIR environment variable, or "/tmp" if  the  variable  is  not  set.
150       Under  Windows,  the value of the TEMP environment variable, or "."  if
151       the variable is not set.
152
153
154
155
156       val quote : string -> string
157
158       Return a quoted version of a file name, suitable for use as  one  argu‐
159       ment in a shell command line, escaping all shell meta-characters.
160
161
162
163
164
165
166OCamldoc                          2007-05-24                       Filename(3)
Impressum