diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-01-02 08:26:24 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-01-02 08:26:24 -0800 |
commit | eac816b9d8a199375cf023a956c0959ccf3bc87b (patch) | |
tree | e39155e3c6946ab419c02e82bfa322fb555bb6a1 /macos.c | |
parent | 3232632fd66bfe7d66b9d6fcf8d3454c97250c88 (diff) | |
download | subsurface-eac816b9d8a199375cf023a956c0959ccf3bc87b.tar.gz |
Use the right function to get resource path on Mac
Much better than hacking together my own...
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'macos.c')
-rw-r--r-- | macos.c | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -16,7 +16,7 @@ static GtkOSXApplication *theApp; kCFAllocatorNull) #define SUBSURFACE_PREFERENCES CFSTR("org.hohndel.subsurface") -#define REL_ICON_PATH "Resources/Subsurface.icns" +#define ICON_NAME "Subsurface.icns" #define UI_FONT "Arial Unicode MS 12" #define DIVELIST_MAC_DEFAULT_FONT "Arial Unicode MS 9" @@ -74,20 +74,10 @@ const char *subsurface_USB_name() const char *subsurface_icon_name() { static char path[1024]; - char *ptr1, *ptr2; - uint32_t size = sizeof(path); /* need extra space to copy icon path */ - if (_NSGetExecutablePath(path, &size) == 0) { - ptr1 = strcasestr(path,"MacOS/subsurface"); - ptr2 = strcasestr(path,"Contents"); - if (ptr1 && ptr2) { - /* we are running as installed app from a bundle */ - if (ptr1 - path < size - strlen(REL_ICON_PATH)) { - strcpy(ptr1,REL_ICON_PATH); - return path; - } - } - } - return "packaging/macosx/Subsurface.icns"; + + snprintf(path, 1024, "%s/%s", quartz_application_get_resource_path(), ICON_NAME); + + return path; } void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, |