summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorSoren Jorvang <soren.jorvang@gmail.com>2010-06-05 18:52:56 +0000
committerSoren Jorvang <soren.jorvang@gmail.com>2010-06-05 18:52:56 +0000
commit7d0f03cb61686f3e82eb0850bf8633484928d6dd (patch)
treec432cf29d348027b9f3486d90c36a5316d7226dd /Source/Core
parent53f9858b94973fdaa1699278b3805fe489aaabdc (diff)
Don't store the absolute pathname of plugins in the configuration file,
just the basename like libPlugin_foo.dylib. Dolphin then loads the plugins relative to the compiled-in plugins directory. This means that you won't have to reselect the plugins when running different builds (in different directories) and is most obviously beneficial on OS X where application bundles are not (should not) be expected to stay in the place where they are first installed. This is tested on OS X and Linux with local/global build options, but not Windows. I don't anticipate any problems on Windows, but that OS does have slightly different semantics with regard to path component separators and file suffixes, so it's something to watch out for. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5621 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Common/Src/DynamicLibrary.cpp3
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp13
-rw-r--r--Source/Core/Core/Src/ConfigManager.cpp12
-rw-r--r--Source/Core/Core/Src/PluginManager.cpp31
4 files changed, 25 insertions, 34 deletions
diff --git a/Source/Core/Common/Src/DynamicLibrary.cpp b/Source/Core/Common/Src/DynamicLibrary.cpp
index 824f8ee258..3ca0b58f8f 100644
--- a/Source/Core/Common/Src/DynamicLibrary.cpp
+++ b/Source/Core/Common/Src/DynamicLibrary.cpp
@@ -59,6 +59,9 @@ const char *DllGetLastError()
*/
int DynamicLibrary::Load(const char* filename)
{
+ std::string LibraryPath = File::GetPluginsDirectory() + filename;
+ filename = LibraryPath.c_str();
+
INFO_LOG(COMMON, "DL: Loading dynamic library %s", filename);
if (!filename || strlen(filename) == 0) {
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index 728628e9e7..8e6006bb58 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -581,13 +581,9 @@ std::string GetPluginsDirectory()
pluginsDir = GetBundleDirectory();
pluginsDir += DIR_SEP;
pluginsDir += PLUGINS_DIR;
-#elif defined __linux__
- pluginsDir = PLUGINS_DIR;
- // FIXME global install
#else
- pluginsDir = PLUGINS_DIR;
+ pluginsDir = PLUGINS_DIR;
#endif
-
pluginsDir += DIR_SEP;
INFO_LOG(COMMON, "GetPluginsDirectory: Setting to %s:", pluginsDir.c_str());
@@ -602,14 +598,11 @@ std::string GetSysDirectory()
sysDir = GetBundleDirectory();
sysDir += DIR_SEP;
sysDir += SYSDATA_DIR;
-#elif defined __linux__
- sysDir = SYSDATA_DIR;
- // FIXME global install
#else
- sysDir = SYSDATA_DIR;
+ sysDir = SYSDATA_DIR;
#endif
-
sysDir += DIR_SEP;
+
INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str());
return sysDir;
}
diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp
index 04d224e44f..25c00268c7 100644
--- a/Source/Core/Core/Src/ConfigManager.cpp
+++ b/Source/Core/Core/Src/ConfigManager.cpp
@@ -182,13 +182,11 @@ void SConfig::LoadSettings()
IniFile ini;
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX));
- std::string PluginsDir = File::GetPluginsDirectory();
-
- // Hard coded default
- m_DefaultGFXPlugin = PluginsDir + DEFAULT_GFX_PLUGIN;
- m_DefaultDSPPlugin = PluginsDir + DEFAULT_DSP_PLUGIN;
- m_DefaultPADPlugin = PluginsDir + DEFAULT_PAD_PLUGIN;
- m_DefaultWiiMotePlugin = PluginsDir + DEFAULT_WIIMOTE_PLUGIN;
+ // Hard coded defaults
+ m_DefaultGFXPlugin = DEFAULT_GFX_PLUGIN;
+ m_DefaultDSPPlugin = DEFAULT_DSP_PLUGIN;
+ m_DefaultPADPlugin = DEFAULT_PAD_PLUGIN;
+ m_DefaultWiiMotePlugin = DEFAULT_WIIMOTE_PLUGIN;
// General
{
diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp
index 32d7ed8cf0..f150f74fab 100644
--- a/Source/Core/Core/Src/PluginManager.cpp
+++ b/Source/Core/Core/Src/PluginManager.cpp
@@ -224,7 +224,7 @@ CPluginInfo::CPluginInfo(const char *_rFilename)
: m_Filename(_rFilename)
, m_Valid(false)
{
- if (!File::Exists(_rFilename))
+ if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str()))
{
PanicAlert("Can't find plugin %s", _rFilename);
return;
@@ -273,17 +273,14 @@ void CPluginManager::GetPluginInfo(CPluginInfo *&info, std::string Filename)
below. */
void *CPluginManager::LoadPlugin(const char *_rFilename)
{
- // Create a string of the filename
- std::string Filename = _rFilename;
-
- if (!File::Exists(_rFilename)) {
+ if (!File::Exists((File::GetPluginsDirectory() + _rFilename).c_str())) {
PanicAlert("Error loading %s: can't find file", _rFilename);
return NULL;
}
/* Avoid calling LoadLibrary() again and instead point to the plugin info that we found when
Dolphin was started */
CPluginInfo *info = NULL;
- GetPluginInfo(info, Filename);
+ GetPluginInfo(info, _rFilename);
if (!info) {
PanicAlert("Error loading %s: can't read info", _rFilename);
return NULL;
@@ -342,11 +339,7 @@ void CPluginManager::ScanForPlugins()
// Get plugins dir
CFileSearch::XStringVector Directories;
-#if defined(__APPLE__)
Directories.push_back(File::GetPluginsDirectory());
-#else
- Directories.push_back(std::string(PLUGINS_DIR));
-#endif
CFileSearch::XStringVector Extensions;
Extensions.push_back("*" PLUGIN_SUFFIX);
@@ -359,17 +352,21 @@ void CPluginManager::ScanForPlugins()
for (size_t i = 0; i < rFilenames.size(); i++)
{
std::string orig_name = rFilenames[i];
- std::string Filename;
+ std::string Filename, Extension;
- if (!SplitPath(rFilenames[i], NULL, &Filename, NULL)) {
+ if (!SplitPath(rFilenames[i], NULL, &Filename, &Extension)) {
printf("Bad Path %s\n", rFilenames[i].c_str());
return;
}
- CPluginInfo PluginInfo(orig_name.c_str());
+ // Leave off the directory component
+ std::string StoredName = Filename;
+ StoredName += Extension;
+
+ CPluginInfo PluginInfo(StoredName.c_str());
if (PluginInfo.IsValid())
{
- // Save the PluginInfo
+ // Save the Plugin
m_PluginInfos.push_back(PluginInfo);
}
}
@@ -504,7 +501,8 @@ void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState)
// Open config window. Input: _rFilename = Plugin filename , Type = Plugin type
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type)
{
- if (! File::Exists(_rFilename)) {
+ if (! File::Exists((File::GetPluginsDirectory() + _rFilename).c_str()))
+ {
PanicAlert("Can't find plugin %s", _rFilename);
return;
}
@@ -531,7 +529,7 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYPE Type, bool Show)
{
- if (!File::Exists(_rFilename))
+ if (! File::Exists((File::GetPluginsDirectory() + _rFilename).c_str()))
{
PanicAlert("Can't find plugin %s", _rFilename);
return;
@@ -549,4 +547,3 @@ void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYP
PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename);
}
}
-