diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000000..9a4056cfdb --- /dev/null +++ b/Info.plist @@ -0,0 +1,8 @@ + + + + + CFBundleIdentifier + org.gnucash.Gnucash + + diff --git a/gnucash/CMakeLists.txt b/gnucash/CMakeLists.txt index 7cd30a83de..254aece47d 100644 --- a/gnucash/CMakeLists.txt +++ b/gnucash/CMakeLists.txt @@ -152,6 +152,7 @@ if (MAC_INTEGRATION) target_link_libraries(gnucash ${OSX_EXTRA_LIBRARIES}) target_compile_options(gnucash-cli PRIVATE ${OSX_EXTRA_COMPILE_FLAGS}) target_link_libraries(gnucash-cli ${OSX_EXTRA_LIBRARIES}) + target_link_options(gnucash-cli PRIVATE -Wl,-sectcreate,__TEXT,__info_plist,${CMAKE_SOURCE_DIR}/Info.plist) endif() install(TARGETS gnucash gnucash-cli DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp index 8fc91e918c..2014a90131 100644 --- a/gnucash/gnucash-commands.cpp +++ b/gnucash/gnucash-commands.cpp @@ -365,6 +365,7 @@ Gnucash::add_quotes (const bo_str& uri) int Gnucash::report_quotes (const char* source, const StrVec& commodities, bool verbose) { + gnc_prefs_init(); try { GncQuotes quotes; diff --git a/libgnucash/app-utils/gnc-quotes.cpp b/libgnucash/app-utils/gnc-quotes.cpp index e236c1ef46..42a8785207 100644 --- a/libgnucash/app-utils/gnc-quotes.cpp +++ b/libgnucash/app-utils/gnc-quotes.cpp @@ -173,7 +173,7 @@ m_version{}, m_sources{}, m_api_key{} m_sources = std::move(sources); auto av_key = gnc_prefs_get_string ("general.finance-quote", "alphavantage-api-key"); - if (!av_key) + if (!(av_key && *av_key)) av_key = getenv("ALPHAVANTAGE_API_KEY"); if (av_key) diff --git a/libgnucash/core-utils/binreloc.c b/libgnucash/core-utils/binreloc.c index 557f9d20f0..828b9acc2e 100644 --- a/libgnucash/core-utils/binreloc.c +++ b/libgnucash/core-utils/binreloc.c @@ -369,6 +369,7 @@ get_mac_bundle_prefix() #if defined ENABLE_BINRELOC && defined MAC_INTEGRATION gchar *id = gtkosx_application_get_bundle_id (); gchar *path = gtkosx_application_get_resource_path (); + gchar *basename = g_path_get_basename (path); /* If id is nullthe app is unbundled and the path is just the path to the application directory. We already have that and our version is better. @@ -377,11 +378,23 @@ get_mac_bundle_prefix() */ if (id == NULL || g_getenv ("GNC_UNINSTALLED")) { + g_free (basename); g_free (path); g_free (id); return NULL; } + g_free (id); + + if (g_strcmp0 ("bin", basename) == 0) + { + g_free (path); + g_free (basename); + return NULL; + } + + g_free (basename); + return path; #endif return NULL;