summaryrefslogtreecommitdiff
path: root/navit/start_apple.m
blob: 114fd4bbe031474c006f8136b1de7a53376c9c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * Navit, a modular navigation system.
 * Copyright (C) 2005-2008 Navit Team
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * version 2 as published by the Free Software Foundation.
 *
 * This program 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 this program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#include "start_real.h"
#import <Foundation/Foundation.h>
#include <glib.h>
#include <stdlib.h>

int
main(int argc, char **argv)
{
	int ret;
	NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
	NSString *locale = [[NSLocale currentLocale] localeIdentifier];
	char *lang=g_strdup_printf("%s.UTF-8",[locale UTF8String]);
	dbg(0,"lang %s",lang);
	setenv("LANG",lang,0);
	setlocale(LC_ALL, NULL);

	const char *s=[appFolderPath UTF8String];
	char *user=g_strdup_printf("%s/../Documents",s);
	chdir(s);
	argv[0]=g_strdup_printf("%s/bin/navit",s);
	setenv("NAVIT_USER_DATADIR",user,0);

	dbg(0,"calling main_real");
	ret=main_real(argc, argv);
	g_free(argv[0]);
	g_free(user);
	[pool release];
	return ret;
}