فهرست منبع

Merge pull request #293 from kainjow/osx-dmg

Fix OS X dmg build
bel2125 9 سال پیش
والد
کامیت
9b89280590
2فایلهای تغییر یافته به همراه11 افزوده شده و 6 حذف شده
  1. 1 1
      Makefile.osx
  2. 10 5
      src/main.c

+ 1 - 1
Makefile.osx

@@ -10,7 +10,7 @@
 PACKAGE = Civetweb
 BUILD_DIR = out
 
-CFLAGS += -DUSE_COCOA -mmacosx-version-min=10.4 -ObjC -arch i386 -arch x86_64
+CFLAGS += -DUSE_COCOA -DENABLE_CREATE_CONFIG_FILE -mmacosx-version-min=10.4 -ObjC -arch i386 -arch x86_64
 LDFLAGS += -framework Cocoa
 
 DMG_DIR = $(BUILD_DIR)/dmg

+ 10 - 5
src/main.c

@@ -2510,10 +2510,15 @@ main(int argc, char *argv[])
 }
 - (void)editConfig
 {
-	create_config_file(g_ctx, g_config_file);
-	[[NSWorkspace sharedWorkspace]
-	           openFile:[NSString stringWithUTF8String:g_config_file]
-	    withApplication:@"TextEdit"];
+	create_config_file(g_ctx, g_config_file_name);
+	NSString *path = [NSString stringWithUTF8String:g_config_file_name];
+	if (![[NSWorkspace sharedWorkspace] openFile:path withApplication:@"TextEdit"]) {
+			NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+			[alert setAlertStyle:NSWarningAlertStyle];
+			[alert setMessageText:NSLocalizedString(@"Unable to open config file.", "")];
+			[alert setInformativeText:path];
+			(void)[alert runModal];
+	}
 }
 - (void)shutDown
 {
@@ -2581,7 +2586,7 @@ main(int argc, char *argv[])
 	[NSApp activateIgnoringOtherApps:YES];
 	[NSApp run];
 
-	stop_civetweb(g_ctx);
+	stop_civetweb();
 
 	return EXIT_SUCCESS;
 }