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.
This commit is contained in:
Lukas W
2015-01-29 13:54:09 +01:00
parent 7be47230e3
commit dc1f8dc365
2 changed files with 4 additions and 1 deletions

View File

@@ -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" );

View File

@@ -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);
}