From 80af3fb3ffb73eb927c214fff7ef5ce61c463e6a Mon Sep 17 00:00:00 2001 From: Cerapter <43446478+Cerapter@users.noreply.github.com> Date: Mon, 17 Dec 2018 22:03:23 +0100 Subject: [PATCH] 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. --- path_functions.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/path_functions.cpp b/path_functions.cpp index a22b775..c51cfde 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);