Commit 31ffb40a authored by Vincent Pinon's avatar Vincent Pinon Committed by Vincent Pinon

Fix bin/melt.exe & libmlt* loading on Windows

parent 60d885b5
......@@ -63,19 +63,17 @@ std::unique_ptr<MltConnection> &MltConnection::self()
void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
{
QString profilePath = mltPath;
if (!KdenliveSettings::mltpath().isEmpty() && QFile::exists(KdenliveSettings::mltpath())) {
return;
}
if (profilePath.isEmpty() || !QFile::exists(profilePath)) profilePath = qgetenv("MLT_PROFILES_PATH");
if (profilePath.isEmpty() || !QFile::exists(profilePath)) profilePath = qgetenv("MLT_DATA") + QStringLiteral("/profiles/");
if (profilePath.isEmpty() || !QFile::exists(profilePath)) profilePath = qgetenv("MLT_PREFIX") + QStringLiteral("/share/mlt/profiles/");
#ifdef Q_OS_WIN
if (profilePath.isEmpty() || !QFile::exists(profilePath)) profilePath = qApp->applicationDirPath() + QStringLiteral("/share/mlt/profiles/");
#else
if (profilePath.isEmpty() || !QFile::exists(profilePath)) profilePath = KdenliveSettings::mltpath();
// build-time definition
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && !QStringLiteral(MLT_DATADIR).isEmpty())
profilePath = QStringLiteral(MLT_DATADIR) + QStringLiteral("/profiles/");
//environment variables should override other settings
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && qEnvironmentVariableIsSet("MLT_PROFILES_PATH"))
profilePath = qgetenv("MLT_PROFILES_PATH");
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && qEnvironmentVariableIsSet("MLT_DATA"))
profilePath = qgetenv("MLT_DATA") + QStringLiteral("/profiles");
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && qEnvironmentVariableIsSet("MLT_PREFIX"))
profilePath = qgetenv("MLT_PREFIX") + QStringLiteral("/share/mlt/profiles");
#ifndef Q_OS_WIN
//stored setting should not be considered on windows as MLT is distributed with each new Kdenlive version
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && !KdenliveSettings::mltpath().isEmpty())
profilePath = KdenliveSettings::mltpath();
#endif
//try to automatically guess MLT path if installed with the same prefix as kdenlive with default data path
if (profilePath.isEmpty() || !QFile::exists(profilePath))
......@@ -126,8 +124,8 @@ void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
if (profilesList.isEmpty()) {
// Cannot find MLT path, try finding melt
if (!meltPath.isEmpty()) {
if (meltPath.contains(QLatin1Char('/'))) {
profilePath = meltPath.section(QLatin1Char('/'), 0, -2) + QStringLiteral("/share/mlt/profiles/");
if(meltPath.contains(QLatin1Char('/'))) {
profilePath = meltPath.section(QLatin1Char('/'), 0, -2) + QStringLiteral("/share/mlt/profiles");
} else {
profilePath = qApp->applicationDirPath() + QStringLiteral("/share/mlt/profiles");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment