From dc1f8dc365073379ec2ea844a17ce5eda2a18890 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Thu, 29 Jan 2015 13:54:09 +0100 Subject: [PATCH] Add data search path support Also add LMMS_DATA_DIR env var to "data:" search paths. When lmms is launched from its build directory (without `make install`ing), LMMS_DATA_DIR can be passed to point lmms to the "data" directory in the source tree. --- src/core/BandLimitedWave.cpp | 2 +- src/core/ConfigManager.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/BandLimitedWave.cpp b/src/core/BandLimitedWave.cpp index de608ba1d..b60cbd633 100644 --- a/src/core/BandLimitedWave.cpp +++ b/src/core/BandLimitedWave.cpp @@ -67,7 +67,7 @@ void BandLimitedWave::generateWaves() int i; // set wavetable directory - s_wavetableDir = ConfigManager::inst()->dataDir() + "wavetables/"; + s_wavetableDir = "data:wavetables/"; // set wavetable files QFile saw_file( s_wavetableDir + "saw.bin" ); diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index 22df6f3d5..bc9a50b48 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -63,6 +63,9 @@ ConfigManager::ConfigManager() : m_flDir( QDir::home().absolutePath() ), m_recoveryFile( QDir(m_workingDir).absoluteFilePath("recover.mmp") ) { + if (! qgetenv("LMMS_DATA_DIR").isEmpty()) + QDir::addSearchPath("data", QString::fromLocal8Bit(qgetenv("LMMS_DATA_DIR"))); + QDir::addSearchPath("data", m_dataDir); }