diff --git a/src/filefinder.cpp b/src/filefinder.cpp index e7002019b53..23e320755a8 100644 --- a/src/filefinder.cpp +++ b/src/filefinder.cpp @@ -338,6 +338,15 @@ std::string find_generic(const DirectoryTree::Args& args) { return FileFinder::Game().FindFile(args); } +std::string find_generic_with_fallback(DirectoryTree::Args& args) { + std::string found = find_generic(args); + if (found.empty()) { + return FileFinder::Save().FindFile(args); + } + + return found; +} + std::string FileFinder::FindImage(StringView dir, StringView name) { DirectoryTree::Args args = { MakePath(dir, name), IMG_TYPES, 1, false }; return find_generic(args); @@ -361,7 +370,7 @@ std::string FileFinder::FindFont(StringView name) { std::string FileFinder::FindText(StringView name) { DirectoryTree::Args args = { MakePath("Text", name), TEXT_TYPES, 1, true }; - return find_generic(args); + return find_generic_with_fallback(args); } Filesystem_Stream::InputStream open_generic(StringView dir, StringView name, DirectoryTree::Args& args) { @@ -387,7 +396,7 @@ Filesystem_Stream::InputStream open_generic_with_fallback(StringView dir, String auto is = open_generic(dir, name, args); if (!is) { is = FileFinder::Save().OpenFile(args); } if (!is) { - Output::Debug("Unable to find in either Game or Save: {}/{}", dir, name); + Output::Debug("Unable to open in either Game or Save: {}/{}", dir, name); } return is;