added third method of matching footage files

This commit is contained in:
itsmattkc
2019-02-09 23:24:43 -08:00
parent bfb3f28b48
commit c435d6da17
+10
View File
@@ -201,15 +201,25 @@ bool LoadThread::load_worker(QFile& f, QXmlStreamReader& stream, int type) {
f->url = attr.value().toString();
if (!QFileInfo::exists(f->url)) { // if path is not absolute
// tries to locate file using a file path relative to the project's current folder
QString proj_dir_test = proj_dir.absoluteFilePath(f->url);
// tries to locate file using a file path relative to the folder the project was saved in
// (unaffected by moving the project file)
QString internal_proj_dir_test = internal_proj_dir.absoluteFilePath(f->url);
// tries to locate file using the file name directly in the project's current folder
QString proj_dir_direct_test = proj_dir.filePath(QFileInfo(f->url).fileName());
if (QFileInfo::exists(proj_dir_test)) { // if path is relative to the project's current dir
f->url = proj_dir_test;
qInfo() << "Matched" << attr.value().toString() << "relative to project's current directory";
} else if (QFileInfo::exists(internal_proj_dir_test)) { // if path is relative to the last directory the project was saved in
f->url = internal_proj_dir_test;
qInfo() << "Matched" << attr.value().toString() << "relative to project's internal directory";
} else if (QFileInfo::exists(proj_dir_direct_test))
f->url = proj_dir_direct_test;
qInfo() << "Matched" << attr.value().toString() << "directly to project's current directory";
} else if (f->url.contains('%')) {
// hack for image sequences (qt won't be able to find the URL with %, but ffmpeg may)
f->url = internal_proj_dir_test;