Remove obsolete file

This commit is contained in:
Alexander Kojevnikov 2012-08-22 09:35:28 -07:00
parent 6f7c565bd1
commit 873b451cd3

View File

@ -1,76 +0,0 @@
/* spek-platform.c
*
* Copyright (C) 2010,2011 Alexander Kojevnikov <alexander@kojevnikov.com>
*
* Spek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Spek is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
*/
#include <glib.h>
#include <gtk/gtk.h>
#ifdef G_OS_WIN32
#include <windows.h>
#include <shellapi.h>
#endif
#ifdef G_OS_DARWIN
#include <gtkosxapplication.h>
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
#endif
#include "spek-platform.h"
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';
g_strchomp (buf);
CFRelease (data);
}
CFRelease (url);
CFRelease (str);
return buf;
#else
gchar *line = NULL;
GFile *file = NULL;
GFileInputStream *file_stream = NULL;
file = g_file_new_for_uri (uri);
file_stream = g_file_read (file, NULL, NULL);
if (file_stream) {
GDataInputStream *data_stream = NULL;
data_stream = g_data_input_stream_new (G_INPUT_STREAM (file_stream));
line = g_data_input_stream_read_line (data_stream, NULL, NULL, NULL);
g_object_unref (data_stream);
g_object_unref (file_stream);
}
g_object_unref (file);
return line;
#endif
}