Fix luma files lost when opening project with AppImage

parent 3619d5ca
...@@ -237,6 +237,7 @@ bool DocumentChecker::hasErrorInClips() ...@@ -237,6 +237,7 @@ bool DocumentChecker::hasErrorInClips()
} }
QMap<QString, QString> autoFixLuma; QMap<QString, QString> autoFixLuma;
QString lumaPath;
// Check existence of luma files // Check existence of luma files
foreach (const QString &lumafile, filesToCheck) { foreach (const QString &lumafile, filesToCheck) {
filePath = lumafile; filePath = lumafile;
...@@ -244,16 +245,29 @@ bool DocumentChecker::hasErrorInClips() ...@@ -244,16 +245,29 @@ bool DocumentChecker::hasErrorInClips()
filePath.prepend(root); filePath.prepend(root);
} }
if (!QFile::exists(filePath)) { if (!QFile::exists(filePath)) {
QString fixedLuma; QString lumaName = filePath.section(QLatin1Char('/'), -1);
// check if this was an old format luma, not in correct folder // check if this was an old format luma, not in correct folder
fixedLuma = filePath.section(QLatin1Char('/'), 0, -2); QString fixedLuma = filePath.section(QLatin1Char('/'), 0, -2);
fixedLuma.append(hdProfile ? QStringLiteral("/HD/") : QStringLiteral("/PAL/")); lumaName.prepend(hdProfile ? QStringLiteral("/HD/") : QStringLiteral("/PAL/"));
fixedLuma.append(filePath.section(QLatin1Char('/'), -1)); fixedLuma.append(lumaName);
if (QFile::exists(fixedLuma)) { if (QFile::exists(fixedLuma)) {
// Auto replace pgm with png for lumas // Auto replace pgm with png for lumas
autoFixLuma.insert(filePath, fixedLuma); autoFixLuma.insert(filePath, fixedLuma);
continue; continue;
} }
// Check MLT folder
if (lumaPath.isEmpty()) {
QDir dir(QCoreApplication::applicationDirPath());
dir.cdUp();
dir.cd(QStringLiteral("share/kdenlive/lumas/"));
lumaPath = dir.absolutePath();
}
lumaName.prepend(lumaPath);
if (QFile::exists(lumaName)) {
autoFixLuma.insert(filePath, lumaName);
continue;
}
if (filePath.endsWith(QLatin1String(".pgm"))) { if (filePath.endsWith(QLatin1String(".pgm"))) {
fixedLuma = filePath.section(QLatin1Char('.') , 0, -2) + QStringLiteral(".png"); fixedLuma = filePath.section(QLatin1Char('.') , 0, -2) + QStringLiteral(".png");
} else if (filePath.endsWith(QLatin1String(".png"))) { } else if (filePath.endsWith(QLatin1String(".png"))) {
...@@ -282,7 +296,6 @@ bool DocumentChecker::hasErrorInClips() ...@@ -282,7 +296,6 @@ bool DocumentChecker::hasErrorInClips()
} }
} }
} }
if (m_missingClips.isEmpty() && missingLumas.isEmpty() && missingProxies.isEmpty() && missingSources.isEmpty() && m_missingFonts.isEmpty()) { if (m_missingClips.isEmpty() && missingLumas.isEmpty() && missingProxies.isEmpty() && missingSources.isEmpty() && m_missingFonts.isEmpty()) {
return false; return false;
} }
......
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