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

@@ -46,6 +46,7 @@
#include <errno.h>
#include <sys/stat.h>
#include "gstdio.h"
#include "glibintl.h"
typedef struct _GIOWin32Channel GIOWin32Channel;
@@ -1336,7 +1337,7 @@ g_io_channel_new_file (const gchar *filename,
}
/* always open 'untranslated' */
fid = open (filename, flags | _O_BINARY, pmode);
fid = g_open (filename, flags | _O_BINARY, pmode);
if (g_io_win32_get_debug_flag ())
{
@@ -1383,6 +1384,32 @@ g_io_channel_new_file (const gchar *filename,
return channel;
}
#ifdef G_OS_WIN32
#undef g_io_channel_new_file
/* Binary compatibility version. Not for newly compiled code. */
GIOChannel *
g_io_channel_new_file (const gchar *filename,
const gchar *mode,
GError **error)
{
gchar *utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
GIOChannel *retval;
if (utf8_filename == NULL)
return NULL;
retval = g_io_channel_new_file_utf8 (utf8_filename, mode, error);
g_free (utf8_filename);
return retval;
}
#endif
static GIOStatus
g_io_win32_set_flags (GIOChannel *channel,
GIOFlags flags,