From 17ecda6af3611a5e0c19b16b5a3592695aaea544 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 30 Sep 2023 01:36:32 +0200 Subject: Try to get app name from compiler flag This isn't working with the spaces handling. Not sure if I want to keep going with this approach as it feels like spaces and escaping is going to get hairy to deal with. --- Makefile | 1 + src/MainMenu.m | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index cfa25a1..df1cb72 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ LOCALIZABLE_STRINGS := $(shell find Internationalization -name Localizable.strin CFLAGS += -x objective-c CFLAGS += -Wall -Werror +CFLAGS += -DMK_APP_NAME="@\"$(APP_NAME)\"" LDFLAGS += -framework Cocoa diff --git a/src/MainMenu.m b/src/MainMenu.m index fff0653..0dff780 100644 --- a/src/MainMenu.m +++ b/src/MainMenu.m @@ -1,5 +1,7 @@ #import "MainMenu.h" +#define AppName MK_APP_NAME + NSMenuItem *MainMenuCreateApplicationMenuItem(); NSMenuItem *MainMenuCreateFileMenuItem(); NSMenuItem *MainMenuCreateEditMenuItem(); @@ -46,6 +48,8 @@ NSMenu *MainMenuCreate() NSString *MainMenuGetApplicationName() { + NSLog(@"App name: %@", AppName); + // TODO: #define this from the Makefile NSString *application_name = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"]; -- cgit v1.2.3