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

Method CreateFileName

src/crashlog.cpp:76–84  ·  view source on GitHub ↗

* Create a timestamped filename. * @param ext The extension for the filename. * @param with_dir Whether to prepend the filename with the personal directory. * @return The filename */

Source from the content-addressed store, hash-verified

74 * @return The filename
75 */
76std::string CrashLog::CreateFileName(std::string_view ext, bool with_dir) const
77{
78 static std::string crashname;
79
80 if (crashname.empty()) {
81 crashname = fmt::format("crash{:%Y%m%d%H%M%S}", fmt::gmtime(time(nullptr)));
82 }
83 return fmt::format("{}{}{}", with_dir ? _personal_dir : std::string{}, crashname, ext);
84}
85
86/**
87 * Fill the crash log buffer with all data of a crash log.

Callers 6

WriteCrashLogMethod · 0.95
WriteSavegameMethod · 0.95
WriteScreenshotMethod · 0.95
MinidumpCallbackMethod · 0.80
MinidumpCallbackMethod · 0.80
MinidumpCallbackMethod · 0.80

Calls 3

gmtimeFunction · 0.85
formatFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected