Introduce the idea of a filename encoding, which is *literally* the

2004-10-27  Matthias Clasen  <mclasen@redhat.com>

	Introduce the idea of a filename encoding, which is
	*literally* the filename encoding on Unix. On windows,
	use the Unicode name converted to UTF-8. (#156325,
	Tor Lillqvist, Owen Taylor)

	* glib/gdir.[hc]:
	* glib/gconvert.[hc]:
	* glib/gfileutils.[hc]:
	* glib/gutils.[hc]:
	* glib/giowin32.c: On Windows, keep old ABI versions
	of GLib pathname api for DLL ABI stability. Use different
	names for the new-style UTF-8 versions. Hide this through
	a #define.

	* glib/gstdio.[hc]: New files containing wrappers for
	POSIX pathname api.

	* glib/glib.symbols: Add new symbols.

	* glib/makegalias.pl: Drop Win32 specific .def syntax,
	include gstdio.h
This commit is contained in:
Matthias Clasen
2004-10-27 16:46:29 +00:00
committed by Matthias Clasen
parent 8e6b272126
commit 8a7eecd7c6
24 changed files with 1503 additions and 96 deletions

View File

@@ -1,3 +1,7 @@
2004-10-27 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/fileutils.sgml: Add some intro.
2004-10-26 Matthias Clasen <mclasen@redhat.com>
* gobject/gobject-docs.sgml: Add an index for 2.6 additions.

View File

@@ -967,6 +967,7 @@ g_option_error_quark
<SECTION>
<TITLE>File Utilities</TITLE>
<FILE>fileutils</FILE>
<INCLUDE>glib.h,glib/gstdio.h</INCLUDE>
GFileError
G_FILE_ERROR
GFileTest
@@ -984,6 +985,16 @@ g_dir_read_name
g_dir_rewind
g_dir_close
<SUBSECTION>
g_open
g_rename
g_mkdir
g_stat
g_unlink
g_remove
g_fopen
g_freopen
<SUBSECTION Private>
g_file_error_quark
</SECTION>

View File

@@ -6,7 +6,31 @@ various file-related functions.
<!-- ##### SECTION Long_Description ##### -->
<para>
There is a group of functions which wrap the common POSIX functions
dealing with filenames (g_open(), g_rename(), g_mkdir(), g_stat(),
g_unlink(), g_remove(), g_fopen(), 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.
</para>
<para>
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
<envar>G_FILENAME_ENCODING</envar> environment variable), or not.
</para>
<para>
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.
</para>
<para>
Another group of functions allows to open and read directories
in the GLib file name encoding. These are g_dir_open(),
g_dir_read_name(), g_dir_rewind(), g_dir_close().
</para>
<!-- ##### SECTION See_Also ##### -->
@@ -223,3 +247,83 @@ An opaque structure representing an opened directory.
@dir:
<!-- ##### FUNCTION g_open ##### -->
<para>
</para>
@filename:
@flags:
@mode:
@Returns:
<!-- ##### FUNCTION g_rename ##### -->
<para>
</para>
@oldfilename:
@newfilename:
@Returns:
<!-- ##### FUNCTION g_mkdir ##### -->
<para>
</para>
@filename:
@mode:
@Returns:
<!-- ##### FUNCTION g_stat ##### -->
<para>
</para>
@filename:
@buf:
@Returns:
<!-- ##### FUNCTION g_unlink ##### -->
<para>
</para>
@filename:
@Returns:
<!-- ##### FUNCTION g_remove ##### -->
<para>
</para>
@filename:
@Returns:
<!-- ##### FUNCTION g_fopen ##### -->
<para>
</para>
@filename:
@mode:
@Returns:
<!-- ##### FUNCTION g_freopen ##### -->
<para>
</para>
@filename:
@mode:
@stream:
@Returns:

View File

@@ -260,6 +260,7 @@ attributes (currently only <command>gcc</command>).
Since: 2.6
<!-- ##### MACRO G_GNUC_INTERNAL ##### -->
<para>
Expands to the GNU C <literal>visibility(hidden)</literal> attribute if the

View File

@@ -610,7 +610,7 @@ The type of functions to be called when a child exists.
@pid: the process id of the child process
@status: Status information about the child process,
see waitpid(2) for more information about this field
@data: user data passed to g_child_watch_add()
@data: user data passed to g_child_watch_add()
<!-- ##### FUNCTION g_child_watch_source_new ##### -->