UFO: Alien Invasion
Loading...
Searching...
No Matches
osx_main.cpp
Go to the documentation of this file.
1
5
6/*
7Copyright (C) 1997-2001 Id Software, Inc.
8
9This program is free software; you can redistribute it and/or
10modify it under the terms of the GNU General Public License
11as published by the Free Software Foundation; either version 2
12of the License, or (at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
18See the GNU General Public License for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24*/
25
26#include <CoreFoundation/CoreFoundation.h>
27#include <SDL_main.h>
28#include <fcntl.h>
29#include <sys/param.h>
30#include <unistd.h>
31
32#include "../../common/common.h"
33
38static void SetWorkingDirectory ()
39{
40 bool success = false;
41 if (CFBundleRef const mainBundle = CFBundleGetMainBundle()) {
42 if (CFURLRef const url = CFBundleCopyBundleURL(mainBundle)) {
43 char path[MAXPATHLEN];
44 if (CFURLGetFileSystemRepresentation(url, true, reinterpret_cast<UInt8*>(path), sizeof(path))) {
45 Com_DPrintf(DEBUG_SYSTEM, "%s = new path\n", path);
46 chdir(path);
47 success = true;
48 }
49 CFRelease(url);
50 }
51 }
52 if (!success)
53 Com_Printf("Failed to get path of main bundle\n");
54}
55
62int main (int argc, char **argv)
63{
65
67 Qcommon_Init(argc, argv);
68 fcntl(0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
69
70 while (1)
72
73 return 0;
74}
void Sys_ConsoleInit(void)
Initialize the console input (tty mode if possible).
void Qcommon_Frame(void)
This is the function that is called directly from main().
Definition common.cpp:1511
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
Definition common.cpp:440
void Qcommon_Init(int argc, char **argv)
Init function.
Definition common.cpp:1095
void Com_Printf(const char *const fmt,...)
Definition common.cpp:428
definitions common between client and server, but not game lib
#define DEBUG_SYSTEM
Definition defines.h:57
static void SetWorkingDirectory()
Sets the current working directory to the top of the application bundle hierarchy.
Definition osx_main.cpp:38
int main(int argc, char **argv)
The entry point for OSX server and client.
Definition osx_main.cpp:62