Commit 62901201 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix detection of MLT on Windows

parent 73c88028
......@@ -106,6 +106,15 @@ std::unique_ptr<MltConnection> &MltConnection::self()
void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
{
QString profilePath = mltPath;
QString appName;
QString libName;
#ifdef Q_OS_WIN
appName = QStringLiteral("melt");
libName = QStringLiteral("mlt");
#else
appName = QStringLiteral("melt-7");
libName = QStringLiteral("mlt-7");
#endif
// environment variables should override other settings
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && qEnvironmentVariableIsSet("MLT_PROFILES_PATH")) {
profilePath = qgetenv("MLT_PROFILES_PATH");
......@@ -114,7 +123,7 @@ void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
profilePath = qgetenv("MLT_DATA") + QStringLiteral("/profiles");
}
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && qEnvironmentVariableIsSet("MLT_PREFIX")) {
profilePath = qgetenv("MLT_PREFIX") + QStringLiteral("/share/mlt-7/profiles");
profilePath = qgetenv("MLT_PREFIX") + QStringLiteral("/share/%1/profiles").arg(libName);
}
#ifndef Q_OS_WIN
// stored setting should not be considered on windows as MLT is distributed with each new Kdenlive version
......@@ -122,7 +131,7 @@ void MltConnection::locateMeltAndProfilesPath(const QString &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)) {
profilePath = QDir::cleanPath(qApp->applicationDirPath() + QStringLiteral("/../share/mlt-7/profiles"));
profilePath = QDir::cleanPath(qApp->applicationDirPath() + QStringLiteral("/../share/%1/profiles").arg(libName));
}
// fallback to build-time definition
if ((profilePath.isEmpty() || !QFile::exists(profilePath)) && !QStringLiteral(MLT_DATADIR).isEmpty()) {
......@@ -137,14 +146,14 @@ void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
#endif
QString meltPath;
if (qEnvironmentVariableIsSet("MLT_PREFIX")) {
meltPath = qgetenv("MLT_PREFIX") + QStringLiteral("/bin/melt-7") + exeSuffix;
meltPath = qgetenv("MLT_PREFIX") + QStringLiteral("/bin/%1").arg(appName) + exeSuffix;
} else {
meltPath = KdenliveSettings::rendererpath();
}
if (!QFile::exists(meltPath)) {
meltPath = QDir::cleanPath(profilePath + QStringLiteral("/../../../bin/melt-7")) + exeSuffix;
meltPath = QDir::cleanPath(profilePath + QStringLiteral("/../../../bin/%1").arg(appName)) + exeSuffix;
if (!QFile::exists(meltPath)) {
meltPath = QStandardPaths::findExecutable("melt-7");
meltPath = QStandardPaths::findExecutable(appName);
if (meltPath.isEmpty()) {
meltPath = QStandardPaths::findExecutable("mlt-melt");
}
......@@ -168,7 +177,7 @@ void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
}
}
if (profilePath.isEmpty()) {
profilePath = QDir::cleanPath(meltPath + QStringLiteral("/../../share/mlt-7/profiles"));
profilePath = QDir::cleanPath(meltPath + QStringLiteral("/../../share/%1/profiles").arg(libName));
KdenliveSettings::setMltpath(profilePath);
}
QStringList profilesFilter;
......@@ -178,11 +187,11 @@ void MltConnection::locateMeltAndProfilesPath(const QString &mltPath)
// Cannot find MLT path, try finding melt
if (!meltPath.isEmpty()) {
if (meltPath.contains(QLatin1Char('/'))) {
profilePath = meltPath.section(QLatin1Char('/'), 0, -2) + QStringLiteral("/share/mlt-7/profiles");
profilePath = meltPath.section(QLatin1Char('/'), 0, -2) + QStringLiteral("/share/%1/profiles").arg(libName);
} else {
profilePath = qApp->applicationDirPath() + QStringLiteral("/share/mlt-7/profiles");
profilePath = qApp->applicationDirPath() + QStringLiteral("/share/%1/profiles").arg(libName);
}
profilePath = QStringLiteral("/usr/local/share/mlt-7/profiles");
profilePath = QStringLiteral("/usr/local/share/%1/profiles").arg(libName);
KdenliveSettings::setMltpath(profilePath);
profilesList = QDir(profilePath).entryList(profilesFilter, QDir::Files);
}
......
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