diff options
| author | Cerapter <43446478+Cerapter@users.noreply.github.com> | 2018-12-17 22:03:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-17 22:03:23 +0100 |
| commit | 80af3fb3ffb73eb927c214fff7ef5ce61c463e6a (patch) | |
| tree | bd4419ab574dbb774c7d33a816b3b6b32061b84d | |
| parent | f1c517667c529c7105b9e8cfa1f76b4b024e81cb (diff) | |
Fixed a bug in the insensitive file searcher function.
This bug couldn't find files with parentheses in them, because it looked for these files according to regex rules.
That is, if you had, say, `Apollo Justice ~ Objection! (UNLIMITED).mp3`, that would be looking for `Apollo Justice ~ Objection! ` + one occurence of `UNLIMITED` followed by a single, custom character, followed by `mp3`.
Note that this search would always fail, since parentheses are grouping characters, and as such, they'd never be acknowledged in the search as characters. `QRegExp::FixedString` forces the search to consider the input as a String, however, escaping characters as needed, which fixes this problem.
| -rw-r--r-- | path_functions.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/path_functions.cpp b/path_functions.cpp index a22b775e..c51cfde3 100644 --- a/path_functions.cpp +++ b/path_functions.cpp @@ -149,7 +149,7 @@ QString AOApplication::get_case_sensitive_path(QString p_file) { return file_parent_dir + "/" + file_basename; //last resort, dirlist parent dir and find case insensitive match - QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive); + QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); QStringList files = QDir(file_parent_dir).entryList(); int result = files.indexOf(file_rx); |
