From 229d0d8ca88bc344bed89e46541b325c1d267996 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Fri, 6 May 2011 15:58:09 +0200 Subject: r Use Erlang specs and types for documentation --- lib/stdlib/doc/src/filelib.xml | 89 +++++++++++++----------------------------- 1 file changed, 27 insertions(+), 62 deletions(-) (limited to 'lib/stdlib/doc/src/filelib.xml') diff --git a/lib/stdlib/doc/src/filelib.xml b/lib/stdlib/doc/src/filelib.xml index fab68ae77c..f3079c7337 100644 --- a/lib/stdlib/doc/src/filelib.xml +++ b/lib/stdlib/doc/src/filelib.xml @@ -41,62 +41,46 @@

For more information about raw file names, see the file module.

-
- DATA TYPES - -filename() = string() | atom() | DeepList | RawFilename - DeepList = [char() | atom() | DeepList] - RawFilename = binary() - If VM is in unicode filename mode, string() and char() are allowed to be > 255. - RawFilename is a filename not subject to Unicode translation, meaning that it - can contain characters not conforming to the Unicode encoding expected from the - filesystem (i.e. non-UTF-8 characters although the VM is started in Unicode - filename mode). -dirname() = filename() -
+ + + + + + + + - ensure_dir(Name) -> ok | {error, Reason} + Ensure that all parent directories for a file or directory exist. - - Name = filename() | dirname() - Reason = posix() -- see file(3) -

The ensure_dir/1 function ensures that all parent - directories for the given file or directory name Name + directories for the given file or directory name Name exist, trying to create them if necessary.

Returns ok if all parent directories already exist - or could be created, or {error, Reason} if some parent + or could be created, or {error, Reason} if some parent directory does not exist and could not be created for some reason.

- file_size(Filename) -> integer() + Return the size in bytes of the file.

The file_size function returns the size of the given file.

- fold_files(Dir, RegExp, Recursive, Fun, AccIn) -> AccOut + Fold over all files matching a regular expression. - - Dir = dirname() - RegExp = regular_expression_string() - Recursive = true|false - Fun = fun(F, AccIn) -> AccOut - AccIn = AccOut = term() -

The fold_files/5 function folds the function - Fun over all (regular) files F in the - directory Dir that match the regular expression RegExp + Fun over all (regular) files F in the + directory Dir that match the regular expression RegExp (see the re module for a description of the allowed regular expressions). - If Recursive is true all sub-directories to Dir + If Recursive is true all sub-directories to Dir are processed. The regular expression matching is done on just the filename without the directory part.

@@ -114,44 +98,32 @@ dirname() = filename()
- is_dir(Name) -> true | false + Test whether Name refer to a directory or not - - Name = filename() | dirname() - -

The is_dir/1 function returns true if Name +

The is_dir/1 function returns true if Name refers to a directory, and false otherwise.

- is_file(Name) -> true | false + Test whether Name refer to a file or directory. - - Name = filename() | dirname() - -

The is_file/1 function returns true if Name +

The is_file/1 function returns true if Name refers to a file or a directory, and false otherwise.

- is_regular(Name) -> true | false + Test whether Name refer to a (regular) file. - - Name = filename() - -

The is_regular/1 function returns true if Name +

The is_regular/1 function returns true if Name refers to a file (regular file), and false otherwise.

- last_modified(Name) -> {{Year,Month,Day},{Hour,Min,Sec}} | 0 + Return the local date and time when a file was last modified. - - Name = filename() | dirname() -

The last_modified/1 function returns the date and time the given file or directory was last modified, or 0 if the file @@ -159,14 +131,11 @@ dirname() = filename() - wildcard(Wildcard) -> list() + Match filenames using Unix-style wildcards. - - Wildcard = filename() | dirname() -

The wildcard/1 function returns a list of all files - that match Unix-style wildcard-string Wildcard.

+ that match Unix-style wildcard-string Wildcard.

The wildcard string looks like an ordinary filename, except that certain "wildcard characters" are interpreted in a special way. The following characters are special: @@ -226,15 +195,11 @@ dirname() = filename() - wildcard(Wildcard, Cwd) -> list() + Match filenames using Unix-style wildcards starting at a specified directory. - - Wildcard = filename() | dirname() - Cwd = dirname() -

The wildcard/2 function works like wildcard/1, - except that instead of the actual working directory, Cwd + except that instead of the actual working directory, Cwd will be used.

-- cgit v1.2.3