mirror of
https://github.com/alexkay/spek.git
synced 2025-04-20 10:27:38 +03:00
osx: Fix new version detection
This commit is contained in:
parent
f1f63561f9
commit
b8c28560ef
@ -42,6 +42,7 @@ if test "x$_gdk_tgt" = xquartz; then
|
||||
PKG_CHECK_MODULES(IGE_MAC, ige-mac-integration)
|
||||
AC_SUBST(IGE_MAC_LIBS)
|
||||
AC_SUBST(IGE_MAC_CFLAGS)
|
||||
AC_DEFINE(G_OS_DARWIN, 1, [Platform detection macro missing in GLib])
|
||||
fi
|
||||
|
||||
GETTEXT_PACKAGE=spek
|
||||
|
@ -24,6 +24,10 @@
|
||||
#include <shellapi.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_DARWIN
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
#include "spek-platform.h"
|
||||
|
||||
void spek_platform_fix_args (gchar **argv, gint argc) {
|
||||
@ -66,6 +70,27 @@ void spek_platform_show_uri (const gchar *uri) {
|
||||
}
|
||||
|
||||
gchar *spek_platform_read_line (const gchar *uri) {
|
||||
#ifdef G_OS_DARWIN
|
||||
/* GIO doesn't work on OS X */
|
||||
CFStringRef str = NULL;
|
||||
CFURLRef url = NULL;
|
||||
CFDataRef data = NULL;
|
||||
CFIndex length = 0;
|
||||
gchar *buf = NULL;
|
||||
|
||||
str = CFStringCreateWithCString (NULL, uri, kCFStringEncodingASCII);
|
||||
url = CFURLCreateWithString (NULL, str, NULL);
|
||||
if (CFURLCreateDataAndPropertiesFromResource (NULL, url, &data, NULL, NULL, NULL)) {
|
||||
length = CFDataGetLength (data);
|
||||
buf = (gchar *) g_malloc (length + 1);
|
||||
CFDataGetBytes (data, CFRangeMake (0, length), (UInt8 *) buf);
|
||||
buf[length] = '\0';
|
||||
CFRelease (data);
|
||||
}
|
||||
CFRelease (url);
|
||||
CFRelease (str);
|
||||
return buf;
|
||||
#else
|
||||
gchar *line = NULL;
|
||||
GFile *file = NULL;
|
||||
GFileInputStream *file_stream = NULL;
|
||||
@ -83,4 +108,5 @@ gchar *spek_platform_read_line (const gchar *uri) {
|
||||
}
|
||||
g_object_unref (file);
|
||||
return line;
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user