mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
[gio compiles and links on win32, not sure how much already works] ifdefed
2007-12-08 Hans Breuer <hans@breuer.org> [gio compiles and links on win32, not sure how much already works] * glocaldirectorymonitor.c : ifdefed out inotify emulation for win32 * glocalfile.c : use HAVE_UNISTD_H; implement file system size info base on win32 API; prefer g_lstat() over lstat(); instead of localtime_r() use an all GLib implementation on win32; get_mount_info() still needs a win32 specifc implementation * glocalfileinfo.c : use HAVE_*_H; start of implementation of win32_get_file_user_info to get owner/group info without uid/gid * glocalfileinputstream.c : include <io.h> on win32 * glocalfileoutputstream.c : include <io.h> on win32 and some S_IS* definition, use g_win32_ftruncate() for G_OS_WIN32 * gwin32appinfo.c : optionalize a bunch on #ifdef AssocQueryString it is available with mingw/w32api but a mess with the M$ Platform SDKs see: http://mail.gnome.org/archives/gtk-devel-list/2007-December/msg00014.html * makefile.msc : updated svn path=/trunk/; revision=6070
This commit is contained in:
@@ -38,6 +38,16 @@
|
||||
#include "glocalfileoutputstream.h"
|
||||
#include "glocalfileinfo.h"
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
|
||||
#endif
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "gioalias.h"
|
||||
|
||||
#define g_local_file_output_stream_get_type _g_local_file_output_stream_get_type
|
||||
@@ -365,7 +375,11 @@ g_local_file_output_stream_truncate (GFileOutputStream *stream,
|
||||
file = G_LOCAL_FILE_OUTPUT_STREAM (stream);
|
||||
|
||||
restart:
|
||||
#ifdef G_OS_WIN32
|
||||
res = g_win32_ftruncate (file->priv->fd, size);
|
||||
#else
|
||||
res = ftruncate (file->priv->fd, size);
|
||||
#endif
|
||||
|
||||
if (res == -1)
|
||||
{
|
||||
@@ -805,7 +819,11 @@ handle_overwrite_open (const char *filename,
|
||||
}
|
||||
|
||||
/* Truncate the file at the start */
|
||||
#ifdef G_OS_WIN32
|
||||
if (g_win32_ftruncate (fd, 0) == -1)
|
||||
#else
|
||||
if (ftruncate (fd, 0) == -1)
|
||||
#endif
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
g_io_error_from_errno (errno),
|
||||
|
Reference in New Issue
Block a user