MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / tryPathOrDefault

Function tryPathOrDefault

src/OpenLoco/src/Environment.cpp:233–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231 }
232
233 static fs::path tryPathOrDefault(fs::path pathToTry, PathId defaultPathId)
234 {
235 if (!pathToTry.empty())
236 {
237 // Getting the directory can fail if config is bad.
238 try
239 {
240 if (fs::is_directory(pathToTry))
241 {
242 return pathToTry;
243 }
244 }
245 catch (std::system_error&)
246 {
247 }
248 }
249
250 // NB: vanilla routines do not use std::filesystem yet, so the trailing slash is still needed.
251 auto defaultPath = getDefaultPathNoWarning(defaultPathId) / "";
252 autoCreateDirectory(defaultPath);
253 return defaultPath;
254 }
255
256 // 0x004412CE
257 void resolvePaths()

Callers 1

resolvePathsFunction · 0.85

Calls 3

getDefaultPathNoWarningFunction · 0.85
autoCreateDirectoryFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected