#define UNICODE

#include <glib.h>
#include <gio/gio.h>
#include <stdio.h>
#include <windows.h>

gchar **files = NULL;

static GOptionEntry entries[] = {
	{G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &files, "files", "FILE"},
	{NULL,0,0,0,NULL,NULL,NULL}
};

int main (int argc, char *argv[])
{
	wprintf(L"%s", GetCommandLineW());
	printf("\r\n");
	int i;
	for(i=0; i<argc; ++i)
		printf("%s ", argv[i]);
	printf("\r\n");
	
	g_type_init();
	GOptionContext *ctx = g_option_context_new("");
	g_option_context_add_main_entries(ctx, entries, NULL);
	g_option_context_parse(ctx, &argc, &argv, NULL);
	
	gchar **x;
	for(x = files; *x; ++x) {
		GFile *gfile = g_file_new_for_commandline_arg(*x);
		if(g_file_query_exists(gfile, NULL)) {
			printf("%s: found\r\n", *x);
		} else {
			printf("%s: not found\r\n", *x);
		}
		g_object_unref(gfile);
	}
	
	getchar();
	
	return 0;
}
