From 6f21c69828a7c455e77e7db8c7c05c9f13569686 Mon Sep 17 00:00:00 2001 From: bushing Date: Mon, 8 Dec 2008 09:53:38 +0000 Subject: [PATCH] Look for plugins in Dolphin.app/Contents/PlugIns on OS X git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1444 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DolphinWX/Src/Config.cpp | 37 ++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Src/Config.cpp b/Source/Core/DolphinWX/Src/Config.cpp index f54b1c9b78..bce51f5ad0 100644 --- a/Source/Core/DolphinWX/Src/Config.cpp +++ b/Source/Core/DolphinWX/Src/Config.cpp @@ -21,6 +21,13 @@ #include "Common.h" #include "IniFile.h" #include "Config.h" +#ifdef __APPLE__ +#include +#include +#include +#include + +#endif SConfig SConfig::m_Instance; @@ -86,7 +93,33 @@ void SConfig::LoadSettings() { IniFile ini; ini.Load(CONFIG_FILE); - +#ifdef __APPLE__ + // Plugin path will be Dolphin.app/Contents/PlugIns + CFURLRef BundleRef, PluginDirRef; + // Get the main bundle for the app + BundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle()); + PluginDirRef = CFBundleCopyBuiltInPlugInsURL(CFBundleGetMainBundle()); + CFStringRef BundlePath = CFURLCopyFileSystemPath(BundleRef, kCFURLPOSIXPathStyle); + CFStringRef PluginDirPath = CFURLCopyFileSystemPath(PluginDirRef, kCFURLPOSIXPathStyle); + char AppBundlePath[MAXPATHLEN], PluginPath[MAXPATHLEN]; + CFStringGetFileSystemRepresentation(BundlePath, AppBundlePath, sizeof(AppBundlePath)); + CFStringGetFileSystemRepresentation(PluginDirPath, PluginPath, sizeof(PluginPath)); +// printf("bundle path = %s %s\n", AppBundlePath, PluginPath); + CFRelease(BundleRef); + CFRelease(BundlePath); + CFRelease(PluginDirRef); + CFRelease(PluginDirPath); + std::string PluginsDir = AppBundlePath; + PluginsDir += DIR_SEP; + PluginsDir += PluginPath; + PluginsDir += DIR_SEP; + + m_DefaultGFXPlugin = PluginsDir + DEFAULT_GFX_PLUGIN; + m_DefaultDSPPlugin = PluginsDir + DEFAULT_DSP_PLUGIN; + m_DefaultPADPlugin = PluginsDir + DEFAULT_PAD_PLUGIN; + m_DefaultWiiMotePlugin = PluginsDir + DEFAULT_WIIMOTE_PLUGIN; + +#else // hard coded default plugin { m_DefaultGFXPlugin = PLUGINS_DIR DIR_SEP DEFAULT_GFX_PLUGIN; @@ -94,7 +127,7 @@ void SConfig::LoadSettings() m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN; m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN; } - +#endif // misc { ini.Get("General", "LastFilename", &m_LastFilename);