Skip to content

Commit

Permalink
Fix #7 by making g_ functions work under Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhx committed Apr 24, 2024
1 parent 3a38937 commit 4d4d0aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Sources/CGLib/glib_bridging.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#ifdef __linux__
#include <sys/types.h>
#include <utime.h>
extern int g_open (const char *, int, ...) __nonnull ((1));
#endif
#define __GLIB_H_INSIDE__
#include <glib/gversion.h>
#include <glib/gversionmacros.h>
Expand Down
2 changes: 2 additions & 0 deletions Sources/GLib/GLib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public func g_mkdir(_ path: UnsafePointer<CChar>, _ mode: gint) -> CInt {
return mkdir(path, mode_t(mode))
}

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

/// Remove a filesystem object.
///
Expand Down

0 comments on commit 4d4d0aa

Please sign in to comment.