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.
This commit is contained in:
Cerapter 2018-12-17 22:03:23 +01:00 committed by GitHub
parent f1c517667c
commit 80af3fb3ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ QString AOApplication::get_case_sensitive_path(QString p_file) {
return file_parent_dir + "/" + file_basename; return file_parent_dir + "/" + file_basename;
//last resort, dirlist parent dir and find case insensitive match //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(); QStringList files = QDir(file_parent_dir).entryList();
int result = files.indexOf(file_rx); int result = files.indexOf(file_rx);