MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / FindGameManualFilePath

Function FindGameManualFilePath

src/help_gui.cpp:47–60  ·  view source on GitHub ↗

* Find the path to the game manual file. * * @param filename The filename to find. * @return std::string The path to the filename if found. */

Source from the content-addressed store, hash-verified

45 * @return std::string The path to the filename if found.
46 */
47static std::optional<std::string> FindGameManualFilePath(std::string_view filename, Subdirectory subdir)
48{
49 static const Searchpath searchpaths[] = {
50 SP_APPLICATION_BUNDLE_DIR, SP_INSTALLATION_DIR, SP_SHARED_DIR, SP_BINARY_DIR, SP_WORKING_DIR
51 };
52
53 for (Searchpath sp : searchpaths) {
54 std::string file_path = FioGetDirectory(sp, subdir);
55 file_path.append(filename);
56 if (FioCheckFileExists(file_path, NO_DIRECTORY)) return file_path;
57 }
58
59 return {};
60}
61
62/** Window class displaying the game manual textfile viewer. */
63struct GameManualTextfileWindow : public TextfileWindow {

Callers 2

EnableTextfileButtonMethod · 0.85

Calls 3

FioGetDirectoryFunction · 0.85
FioCheckFileExistsFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected