Skip to content

Commit

Permalink
Get rid of individual variant dirs for SoundSource plugins. Add $BUIL…
Browse files Browse the repository at this point in the history
…D_DIR/plugins to the SoundSource plugin search path if the folder exists. Fixes Bug 1196833.
  • Loading branch information
rryan committed Mar 29, 2014
1 parent f5ac43b commit ce3c119
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
6 changes: 3 additions & 3 deletions plugins/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ plugins = []

soundsourcem4a = SConscript(
File('soundsourcem4a/SConscript'),
variant_dir=Dir(build.build_dir + "/m4a"),
variant_dir=Dir(build.build_dir),
duplicate=0, exports=['build'])
plugins.extend(soundsourcem4a)

soundsourcewv = SConscript(
File('soundsourcewv/SConscript'),
variant_dir=Dir(build.build_dir + "/wv"),
variant_dir=Dir(build.build_dir),
duplicate=0, exports=['build'])
plugins.extend(soundsourcewv)

soundsourcemediafoundation = SConscript(
File('soundsourcemediafoundation/SConscript'),
variant_dir=Dir(build.build_dir + "/mediafoundation"),
variant_dir=Dir(build.build_dir),
duplicate=0, exports=['build'])
plugins.extend(soundsourcemediafoundation)

Expand Down
32 changes: 28 additions & 4 deletions src/soundsourceproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ void SoundSourceProxy::loadPlugins() {
pluginDirs << QDir(pluginPath);
}

const QString dataLocation = QDesktopServices::storageLocation(
QDesktopServices::DataLocation);
const QString applicationPath = QCoreApplication::applicationDirPath();

#ifdef __LINUX__
// TODO(rryan): Why can't we use applicationDirPath() and assume it's in the
// 'bin' folder of $PREFIX, so we just traverse
Expand All @@ -107,12 +111,22 @@ void SoundSourceProxy::loadPlugins() {
pluginDirs << libPluginDir;
}

QDir dataPluginDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
QDir dataPluginDir(dataLocation);
if (dataPluginDir.cd("plugins") && dataPluginDir.cd("soundsource")) {
pluginDirs << dataPluginDir;
}

// For people who build from source.
QDir developer32Root(applicationPath);
if (developer32Root.cd("lin32_build") && developer32Root.cd("plugins")) {
pathElements << developer32Root.absolutePath();
}
QDir developer64Root(applicationPath);
if (developer64Root.cd("lin64_build") && developer64Root.cd("plugins")) {
pathElements << developer64Root.absolutePath();
}
#elif __WINDOWS__
QDir appPluginDir(QCoreApplication::applicationDirPath());
QDir appPluginDir(applicationPath);
if (appPluginDir.cd("plugins") && appPluginDir.cd("soundsource")) {
pluginDirs << appPluginDir;
}
Expand All @@ -121,12 +135,22 @@ void SoundSourceProxy::loadPlugins() {
// TODO(XXX): Our SCons bundle target doesn't handle plugin subdirectories
// :( so we can't do:
//blah/Mixxx.app/Contents/PlugIns/soundsource
QDir bundlePluginDir(QCoreApplication::applicationDirPath());
QDir bundlePluginDir(applicationPath);
if (bundlePluginDir.cdUp() && bundlePluginDir.cd("PlugIns")) {
pluginDirs << bundlePluginDir;
}

QDir dataPluginDir(QDesktopServices::storageLocation(QDesktopServices::DataLocation));
// For people who build from source.
QDir developer32Root(applicationPath);
if (developer32Root.cd("osx32_build") && developer32Root.cd("plugins")) {
pluginDirs << developer32Root.absolutePath();
}
QDir developer64Root(applicationPath);
if (developer64Root.cd("osx64_build") && developer64Root.cd("plugins")) {
pluginDirs << developer64Root.absolutePath();
}

QDir dataPluginDir(dataLocation);
if (dataPluginDir.cd("Plugins") && dataPluginDir.cd("soundsource")) {
pluginDirs << dataPluginDir;
}
Expand Down
10 changes: 2 additions & 8 deletions src/vamp/vampanalyser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,14 @@ void VampAnalyser::initializePluginPaths() {
QStringList pathElements = vampPath.length() > 0 ? vampPath.split(PATH_SEPARATOR)
: QStringList();

const QString homeLocation = QDesktopServices::storageLocation(
QDesktopServices::HomeLocation);
const QString dataLocation = QDesktopServices::storageLocation(
QDesktopServices::DataLocation);
const QString applicationPath = QCoreApplication::applicationDirPath();

#ifdef __WINDOWS__
QDir winVampPath(applicationPath);
if (winVampPath.cd("plugins")) {
if (winVampPath.cd("vamp")) {
pathElements << winVampPath.absolutePath().replace("/","\\");
} else {
qDebug() << winVampPath.absolutePath() << "does not exist!";
}
if (winVampPath.cd("plugins") && winVampPath.cd("vamp")) {
pathElements << winVampPath.absolutePath().replace("/","\\");
} else {
qDebug() << winVampPath.absolutePath() << "does not exist!";
}
Expand Down

0 comments on commit ce3c119

Please sign in to comment.