Some cleanups from Nic.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1548 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2005-02-19 18:40:24 +00:00
parent 2a72461b3a
commit 5ba7dd299d
2 changed files with 18 additions and 21 deletions
+8
View File
@@ -7,5 +7,13 @@
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
/* An internal Apple class used to setup Apple menus */
@interface NSAppleMenuController:NSObject {}
- (void)controlMenu:(NSMenu *)aMenu;
@end
@interface SDLMain : NSObject @interface SDLMain : NSObject
@end @end
@interface SDLApplication : NSApplication
@end
+10 -21
View File
@@ -20,14 +20,6 @@ static int gArgc;
static char **gArgv; static char **gArgv;
static BOOL gFinderLaunch; static BOOL gFinderLaunch;
/* An internal Apple class used to setup Apple menus */
@interface NSAppleMenuController:NSObject {}
- (void)controlMenu:(NSMenu *)aMenu;
@end
@interface SDLApplication : NSApplication
@end
@implementation SDLApplication @implementation SDLApplication
/* Invoked from the Quit menu item */ /* Invoked from the Quit menu item */
- (void)terminate:(id)sender - (void)terminate:(id)sender
@@ -66,8 +58,7 @@ basename (char *path)
} }
/* Set the working directory to the .app's parent directory */ /* Set the working directory to the .app's parent directory */
- (void) - (void) setupWorkingDirectory:(BOOL)shouldChdir
setupWorkingDirectory:(BOOL)shouldChdir
{ {
char origindir[PATH_MAX]; char origindir[PATH_MAX];
char *c; char *c;
@@ -88,8 +79,8 @@ setupWorkingDirectory:(BOOL)shouldChdir
if (chdir (origindir) != 0) if (chdir (origindir) != 0)
abort (); abort ();
/* then chdir to the .app's parent */ /* then chdir to the .app's parent */
if (chdir ("../../../") != 0) if ( chdir ("../Resources/") != 0 )
abort (); abort();
} }
void void
@@ -199,17 +190,16 @@ CustomApplicationMain (int argc, char **argv)
} }
/* Called when the internal event loop has just started running */ /* Called when the internal event loop has just started running */
- (void) - (void) applicationDidFinishLaunching: (NSNotification *) note
applicationDidFinishLaunching: (NSNotification *) note
{ {
int status; int status;
/* allow Cocoa to hear keystrokes like Command-Q, etc. */
setenv ("SDL_ENABLEAPPEVENTS", "1", 1);
/* Set the working directory to the .app's parent directory */ /* Set the working directory to the .app's parent directory */
[self setupWorkingDirectory:gFinderLaunch]; [self setupWorkingDirectory:gFinderLaunch];
/* allow Cocoa to hear keystrokes like Command-Q, etc. */
setenv ("SDL_ENABLEAPPEVENTS", "1", 1);
/* Hand off to main application code */ /* Hand off to main application code */
status = SDL_main (gArgc, gArgv); status = SDL_main (gArgc, gArgv);
@@ -222,8 +212,7 @@ applicationDidFinishLaunching: (NSNotification *) note
@implementation NSString (ReplaceSubString) @implementation NSString (ReplaceSubString)
- (NSString *) - (NSString *) stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
{ {
unsigned int bufferSize; unsigned int bufferSize;
unsigned int selfLen = [self length]; unsigned int selfLen = [self length];
@@ -272,8 +261,8 @@ main (int argc, char **argv)
/* Copy the arguments into a global variable */ /* Copy the arguments into a global variable */
int i; int i;
/* This is passed if we are launched by double-clicking */ /* If we are launched by double-clicking, argv[1] is "-psn_<some_number> */
if (argc >= 2 && strcmp (argv[1], "-psn") == 0) { if ( argc >= 2 && strncmp (argv[1], "-psn_", 5) == 0 ) {
gArgc = 1; gArgc = 1;
gFinderLaunch = YES; gFinderLaunch = YES;
} else { } else {