Module(Filename)

NAME
Filename - Operations on file names.

Module
Module Filename

Documentation

Module Filename
 : sig end

Operations on file names.

val current_dir_name : string

The conventional name for the current directory (e.g. . in Unix).

val parent_dir_name : string

The conventional name for the parent of the current directory (e.g. .. in Unix).

val concat : string -> string -> string

concat dir file returns a file name that designates file file in directory dir

val is_relative : string -> bool

Return true if the file name is relative to the current directory, false if it is absolute (i.e. in Unix, starts with / ).

val is_implicit : string -> bool

Return true if the file name is relative and does not start with an explicit reference to the current directory ( ./ or ../ in Unix), false if it starts with an explicit reference to the root directory or the current directory.

val check_suffix : string -> string -> bool

check_suffix name suff returns true if the filename name ends with the suffix suff

val chop_suffix : string -> string -> string

chop_suffix name suff removes the suffix suff from the filename name name does not end with the suffix suff

val chop_extension : string -> string

Return the given file name without its extension. The extension is the shortest suffix starting with a period, .xyz for instance.

Raise Invalid_argument if the given name does not contain a period.

val basename : string -> string

Split a file name into directory name / base file name. concat (dirname name) (basename name) returns a file name which is equivalent to name current directory to dirname name (with Sys.chdir ), references to basename name (which is a relative file name) designate the same file as name before the call to Sys.chdir

val dirname : string -> string

See Filename.basename

val temp_file : string -> string -> string

temp_file prefix suffix returns the name of a fresh temporary file in the temporary directory. The base name of the temporary file is formed by concatenating prefix , then a suitably chosen integer number, then suffix The temporary file is created empty, with permissions 0o600 (readable and writable only by the file owner). The file is guaranteed to be different from any other file that existed when temp_file was called. Under Unix, the temporary directory is /tmp by default; if set, the value of the environment variable TMPDIR is used instead. Under Windows, the name of the temporary directory is the value of the environment variable TEMP , or C: emp by default. Under MacOS 9, the name of the temporary directory is given by the environment variable TempFolder ; if not set, temporary files are created in the current directory.

val open_temp_file : ?mode:Pervasives.open_flag list -> string -> string -> string * Pervasives.out_channel

Same as Filename.temp_file , but returns both the name of a fresh temporary file, and an output channel opened (atomically) on this file. This function is more secure than temp_file : there is no risk that the temporary file will be modified (e.g. replaced by a symbolic link) before the program opens it. The optional argument mode is a list of additional flags to control the opening of the file. It can contain one or several of Open_append , Open_binary , and Open_text [Open_text] (open in text mode).

val quote : string -> string

Return a quoted version of a file name, suitable for use as one argument in a shell command line, escaping all shell meta-characters.