mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 22:48:18 +00:00
Stop using deprecated APIs on macOS in server launcher
(cherry picked from commit dcbd8197a4
)
This commit is contained in:
parent
94bbe2bc09
commit
dae85e244c
|
@ -5,11 +5,11 @@
|
||||||
NSTask *task;
|
NSTask *task;
|
||||||
NSFileHandle *file;
|
NSFileHandle *file;
|
||||||
}
|
}
|
||||||
- (void)listenTo: (NSTask*)t;
|
- (void)listenTo: (NSTask *)t;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation ServerView
|
@implementation ServerView
|
||||||
- (void)listenTo: (NSTask*)t;
|
- (void)listenTo: (NSTask *)t
|
||||||
{
|
{
|
||||||
NSPipe *pipe;
|
NSPipe *pipe;
|
||||||
task = t;
|
task = t;
|
||||||
|
@ -49,24 +49,20 @@ void runServer()
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSApp = [NSApplication sharedApplication];
|
NSApp = [NSApplication sharedApplication];
|
||||||
NSBundle* mainBundle = [NSBundle mainBundle];
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||||
NSTask *task;
|
NSTask *task;
|
||||||
task = [[NSTask alloc] init];
|
task = [[NSTask alloc] init];
|
||||||
[task setCurrentDirectoryPath: [mainBundle resourcePath]];
|
[task setCurrentDirectoryPath: [mainBundle resourcePath]];
|
||||||
|
|
||||||
// get a server config
|
// get a server config
|
||||||
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
|
NSOpenPanel *openDlg = [NSOpenPanel openPanel];
|
||||||
[openDlg setCanChooseFiles:YES];
|
[openDlg setCanChooseFiles:YES];
|
||||||
|
|
||||||
if([openDlg runModalForDirectory:nil file:nil] != NSOKButton)
|
if([openDlg runModal] != NSOKButton)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NSArray* filenames = [openDlg filenames];
|
NSString *filename = [[openDlg URL] path];
|
||||||
if([filenames count] != 1)
|
NSArray *arguments = [NSArray arrayWithObjects: @"-f", filename, nil];
|
||||||
return;
|
|
||||||
|
|
||||||
NSString* filename = [filenames objectAtIndex: 0];
|
|
||||||
NSArray* arguments = [NSArray arrayWithObjects: @"-f", filename, nil];
|
|
||||||
|
|
||||||
// run server
|
// run server
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
|
@ -104,7 +100,7 @@ void runServer()
|
||||||
[pool release];
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
runServer();
|
runServer();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue