diff options
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index dc95dc34..ee6db6b9 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -544,8 +544,18 @@ QString AOApplication::get_court_sfx(QString p_identifier, QString p_misc) QString AOApplication::get_sfx_suffix(VPath sound_to_check) { - return get_real_suffixed_path(sound_to_check, - {".opus", ".ogg", ".mp3", ".wav", ".mid", ".midi", ".xm", ".it", ".s3m", ".mod", ".mtm", ".umx" }); + QStringList suffixes = {".opus", ".ogg", ".mp3", ".wav", ".mid", ".midi", ".xm", ".it", ".s3m", ".mod", ".mtm", ".umx" }; + // Check if we were provided a direct filepath with a suffix already + QString path = sound_to_check.toQString(); + // Loop through our suffixes + for (const QString &suffix : suffixes) { + // If our VPath ends with a valid suffix + if (path.endsWith(suffix, Qt::CaseInsensitive)) + // Return that as the path + return get_real_path(sound_to_check); + } + // Otherwise, ignore the provided suffix and check our own + return get_real_path(sound_to_check, suffixes); } QString AOApplication::get_image_suffix(VPath path_to_check, bool static_image) @@ -556,7 +566,17 @@ QString AOApplication::get_image_suffix(VPath path_to_check, bool static_image) } suffixes.append(".png"); - return get_real_suffixed_path(path_to_check, suffixes); + // Check if we were provided a direct filepath with a suffix already + QString path = path_to_check.toQString(); + // Loop through our suffixes + for (const QString &suffix : suffixes) { + // If our VPath ends with a valid suffix + if (path.endsWith(suffix, Qt::CaseInsensitive)) + // Return that as the path + return get_real_path(path_to_check); + } + // Otherwise, ignore the provided suffix and check our own + return get_real_path(path_to_check, suffixes); } // returns whatever is to the right of "search_line =" within target_tag and |
