diff options
| author | David Skoland <davidskoland@gmail.com> | 2018-11-17 18:57:35 +0100 |
|---|---|---|
| committer | David Skoland <davidskoland@gmail.com> | 2018-11-17 18:57:35 +0100 |
| commit | 06c7a95bc2b10af9562e21825b810f045d410a57 (patch) | |
| tree | 404f4be14d435791dada75fd1890499add083b54 /path_functions.cpp | |
| parent | ee4b9acfeb1a860cf67957548c544ff893ce71bb (diff) | |
changed variable names for clarity
Diffstat (limited to 'path_functions.cpp')
| -rw-r--r-- | path_functions.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/path_functions.cpp b/path_functions.cpp index 4d7e246c..d07a6481 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -144,18 +144,28 @@ QString AOApplication::get_evidence_path(QString p_file) QString AOApplication::get_case_sensitive_path(QString 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; - QString file_name = file.fileName(); - QString file_path = file.absolutePath(); + QString file_basename = file.fileName(); + QString file_parent_dir = file.absolutePath(); - QRegExp file_rx = QRegExp(file_name, Qt::CaseInsensitive); - QStringList files = QDir(file_path).entryList(); +#ifdef DEBUG_PATH_FUNCTIONS + 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); 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 return p_file; |
