mirror of
https://github.com/alexkay/spek.git
synced 2025-06-12 21:32:31 +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)
|
PKG_CHECK_MODULES(IGE_MAC, ige-mac-integration)
|
||||||
AC_SUBST(IGE_MAC_LIBS)
|
AC_SUBST(IGE_MAC_LIBS)
|
||||||
AC_SUBST(IGE_MAC_CFLAGS)
|
AC_SUBST(IGE_MAC_CFLAGS)
|
||||||
|
AC_DEFINE(G_OS_DARWIN, 1, [Platform detection macro missing in GLib])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GETTEXT_PACKAGE=spek
|
GETTEXT_PACKAGE=spek
|
||||||
|
@ -24,6 +24,10 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef G_OS_DARWIN
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "spek-platform.h"
|
#include "spek-platform.h"
|
||||||
|
|
||||||
void spek_platform_fix_args (gchar **argv, gint argc) {
|
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) {
|
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;
|
gchar *line = NULL;
|
||||||
GFile *file = NULL;
|
GFile *file = NULL;
|
||||||
GFileInputStream *file_stream = NULL;
|
GFileInputStream *file_stream = NULL;
|
||||||
@ -83,4 +108,5 @@ gchar *spek_platform_read_line (const gchar *uri) {
|
|||||||
}
|
}
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
return line;
|
return line;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user