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
This commit is contained in:
bushing 2008-12-08 09:53:38 +00:00
parent 05e9ae0f6f
commit 6f21c69828
1 changed files with 35 additions and 2 deletions

View File

@ -21,6 +21,13 @@
#include "Common.h"
#include "IniFile.h"
#include "Config.h"
#ifdef __APPLE__
#include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFUrl.h>
#include <CoreFoundation/CFBundle.h>
#include <sys/param.h>
#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);