1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset= ISO-8859-1">
<TITLE>
Module Filename: operations on file names
</TITLE>
</HEAD>
<BODY >
<A HREF="manual036.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual038.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<A HREF="manual030.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
<HR>
<H2>17.7 Module <TT>Filename</TT>: operations on file names</H2><A NAME="s:Filename"></A>
<A NAME="@manual211"></A><PRE>
val current_dir_name : string
</PRE>
<A NAME="@manual212"></A><BLOCKQUOTE>
The conventional name for the current directory
(e.g. <CODE>.</CODE> in Unix).
</BLOCKQUOTE>
<PRE>
val concat : string -> string -> string
</PRE>
<A NAME="@manual213"></A><BLOCKQUOTE>
<CODE>concat dir file</CODE> returns a file name that designates file
<CODE>file</CODE> in directory <CODE>dir</CODE>.
</BLOCKQUOTE>
<PRE>
val is_relative : string -> bool
</PRE>
<A NAME="@manual214"></A><BLOCKQUOTE>
Return <CODE>true</CODE> if the file name is relative to the current
directory, <CODE>false</CODE> if it is absolute (i.e. in Unix, starts
with <CODE>/</CODE>.
</BLOCKQUOTE>
<PRE>
val is_implicit : string -> bool
</PRE>
<A NAME="@manual215"></A><BLOCKQUOTE>
Return <CODE>true</CODE> if the file name is relative and does not start
with an explicit reference to the current directory (<CODE>./</CODE> or
<CODE>../</CODE> in Unix), <CODE>false</CODE> if it starts with an explicit reference
to the root directory or the current directory.
</BLOCKQUOTE>
<PRE>
val check_suffix : string -> string -> bool
</PRE>
<A NAME="@manual216"></A><BLOCKQUOTE>
<CODE>check_suffix name suff</CODE> returns <CODE>true</CODE> if the filename <CODE>name</CODE>
ends with the suffix <CODE>suff</CODE>.
</BLOCKQUOTE>
<PRE>
val chop_suffix : string -> string -> string
</PRE>
<A NAME="@manual217"></A><BLOCKQUOTE>
<CODE>chop_suffix name suff</CODE> removes the suffix <CODE>suff</CODE> from
the filename <CODE>name</CODE>. The behavior is undefined if <CODE>name</CODE> does not
end with the suffix <CODE>suff</CODE>.
</BLOCKQUOTE>
<PRE>
val chop_extension : string -> string
</PRE>
<A NAME="@manual218"></A><BLOCKQUOTE>
Return the given file name without its extension. The extension
is the shortest suffix starting with a period, <CODE>.xyz</CODE> for instance.
Raise <CODE>Invalid_argument</CODE> if the given name does not contain
a period.
</BLOCKQUOTE>
<PRE>
val basename : string -> string
val dirname : string -> string
</PRE>
<A NAME="@manual219"></A><A NAME="@manual220"></A><BLOCKQUOTE>
Split a file name into directory name / base file name.
<CODE>concat (dirname name) (basename name)</CODE> returns a file name
which is equivalent to <CODE>name</CODE>. Moreover, after setting the
current directory to <CODE>dirname name</CODE> (with <CODE>Sys.chdir</CODE>),
references to <CODE>basename name</CODE> (which is a relative file name)
designate the same file as <CODE>name</CODE> before the call to <CODE>Sys.chdir</CODE>.
</BLOCKQUOTE>
<PRE>
val temp_file: string -> string -> string
</PRE>
<A NAME="@manual221"></A><BLOCKQUOTE>
<CODE>temp_file prefix suffix</CODE> returns the name of a
non-existent temporary file in the temporary directory.
The base name of the temporary file is formed by concatenating
<CODE>prefix</CODE>, then a suitably chosen integer number, then <CODE>suffix</CODE>.
Under Unix, the temporary directory is <CODE>/tmp</CODE> by default; if set,
the value of the environment variable <CODE>TMPDIR</CODE> is used instead.
Under Windows, the name of the temporary directory is the
value of the environment variable <CODE>TEMP</CODE>,
or <CODE>C:\temp</CODE> by default.
Under MacOS, the name of the temporary directory is given
by the environment variable <CODE>TempFolder</CODE>; if not set,
temporary files are created in the current directory.
</BLOCKQUOTE>
<HR>
<A HREF="manual036.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="manual038.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<A HREF="manual030.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
</BODY>
</HTML>
|