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

Function findCustomObjectPath

src/OpenLoco/src/Objects/ObjectManager.cpp:710–719  ·  view source on GitHub ↗

All object files are based on their internal object header name but there is a chance of a name collision this function works out if the name is possible and if not permutes the name until it is valid.

Source from the content-addressed store, hash-verified

708 // there is a chance of a name collision this function works out if the name
709 // is possible and if not permutes the name until it is valid.
710 static fs::path findCustomObjectPath(std::string& filename)
711 {
712 auto objPath = Environment::getPath(Environment::PathId::customObjects) / (filename + ".DAT");
713 while (fs::exists(objPath))
714 {
715 permutateObjectFilename(filename);
716 objPath.replace_filename(filename + ".DAT");
717 }
718 return objPath;
719 }
720
721 static void sanatiseObjectFilename(std::string& filename)
722 {

Callers 1

installObjectFunction · 0.85

Calls 2

getPathFunction · 0.85
permutateObjectFilenameFunction · 0.85

Tested by

no test coverage detected