Skip to content

Commit 0026cbf

Browse files
committed
Fix #7 by making g_ functions work under Linux.
1 parent 41a778a commit 0026cbf

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/CGLib/glib_bridging.h

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
#ifdef __linux__
2+
#include <sys/types.h>
3+
#include <utime.h>
4+
extern int g_open (const char *, int, ...) __nonnull ((1));
5+
#endif
16
#define __GLIB_H_INSIDE__
27
#include <glib/gversion.h>
38
#include <glib/gversionmacros.h>

Sources/GLib/GLib.swift

+2
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ public func g_mkdir(_ path: UnsafePointer<CChar>, _ mode: gint) -> CInt {
318318
return mkdir(path, mode_t(mode))
319319
}
320320

321+
#if os(macOS)
321322
/// Open a file.
322323
///
323324
/// This function is a wrapper around the `open()` system call,
@@ -332,6 +333,7 @@ public func g_mkdir(_ path: UnsafePointer<CChar>, _ mode: gint) -> CInt {
332333
public func g_open(_ path: UnsafePointer<CChar>, _ flags: CInt, _ mode: gint = 0) -> CInt {
333334
return open(path, flags, mode_t(mode))
334335
}
336+
#endif
335337

336338
/// Remove a filesystem object.
337339
///

0 commit comments

Comments
 (0)