changed variable names for clarity

This commit is contained in:
David Skoland 2018-11-17 18:57:35 +01:00
parent ee4b9acfeb
commit 06c7a95bc2

View File

@ -144,18 +144,28 @@ QString AOApplication::get_evidence_path(QString p_file)
QString AOApplication::get_case_sensitive_path(QString p_file) { QString AOApplication::get_case_sensitive_path(QString p_file) {
QFileInfo file(p_file); QFileInfo file(p_file);
//quick check to see if it's actually there first //quick check to see if it's actually there first(also serves as base case for recursion)
if (file.exists()) return p_file; if (file.exists()) return p_file;
QString file_name = file.fileName(); QString file_basename = file.fileName();
QString file_path = file.absolutePath(); QString file_parent_dir = file.absolutePath();
QRegExp file_rx = QRegExp(file_name, Qt::CaseInsensitive); #ifdef DEBUG_PATH_FUNCTIONS
QStringList files = QDir(file_path).entryList(); qDebug() << "file_basename: " << file_basename;
qDebug() << "file_parent_dir: " << file_parent_dir;
#endif
//if parent directory does not exist, recurse
//if (!file_exists(file_parent_dir)) {
//}
QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive);
QStringList files = QDir(file_parent_dir).entryList();
int result = files.indexOf(file_rx); int result = files.indexOf(file_rx);
if (result != -1) if (result != -1)
return file_path + "/" + files.at(result); return file_parent_dir + "/" + files.at(result);
//if nothing is found, let the caller handle the missing file //if nothing is found, let the caller handle the missing file
return p_file; return p_file;