
@c %start of fragment

@node File Utilities
@chapter File Utilities
various file-related functions.

@section Overview
There is a group of functions which wrap the common POSIX functions dealing with
filenames (@code{g-open}, @code{g-rename}, @code{g-mkdir}, @code{g-stat},
@code{g-unlink}, @code{g-remove}, @code{g-fopen}, @code{g-freopen}). The point
of these wrappers is to make it possible to handle file names with any Unicode
characters in them on Windows without having to use ifdefs and the wide
character API in the application code.

The pathname argument should be in the GLib file name encoding. On POSIX this is
the actual on-disk encoding which might correspond to the locale settings of the
process (or the @env{G_FILENAME_ENCODING} environment variable), or not.

On Windows the GLib file name encoding is UTF-8. Note that the Microsoft C
library does not use UTF-8, but has separate APIs for current system code page
and wide characters (UTF-16). The GLib wrappers call the wide character API if
present (on modern Windows systems), otherwise convert to/from the system code
page.

Another group of functions allows to open and read directories in the GLib file
name encoding. These are @code{g-dir-open}, @code{g-dir-read-name},
@code{g-dir-rewind}, @code{g-dir-close}.

@section Usage
@include defuns-fileutils.xml.texi

@c %end of fragment
