mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
3232632fd6
commit
eac816b9d8
1 changed files with 5 additions and 15 deletions
20
macos.c
20
macos.c
|
@ -16,7 +16,7 @@ static GtkOSXApplication *theApp;
|
||||||
kCFAllocatorNull)
|
kCFAllocatorNull)
|
||||||
|
|
||||||
#define SUBSURFACE_PREFERENCES CFSTR("org.hohndel.subsurface")
|
#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 UI_FONT "Arial Unicode MS 12"
|
||||||
#define DIVELIST_MAC_DEFAULT_FONT "Arial Unicode MS 9"
|
#define DIVELIST_MAC_DEFAULT_FONT "Arial Unicode MS 9"
|
||||||
|
|
||||||
|
@ -74,20 +74,10 @@ const char *subsurface_USB_name()
|
||||||
const char *subsurface_icon_name()
|
const char *subsurface_icon_name()
|
||||||
{
|
{
|
||||||
static char path[1024];
|
static char path[1024];
|
||||||
char *ptr1, *ptr2;
|
|
||||||
uint32_t size = sizeof(path); /* need extra space to copy icon path */
|
snprintf(path, 1024, "%s/%s", quartz_application_get_resource_path(), ICON_NAME);
|
||||||
if (_NSGetExecutablePath(path, &size) == 0) {
|
|
||||||
ptr1 = strcasestr(path,"MacOS/subsurface");
|
return path;
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
||||||
|
|
Loading…
Add table
Reference in a new issue