MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / FolderBasename

Function FolderBasename

engine/Poseidon/Core/ModCollection.cpp:80–87  ·  view source on GitHub ↗

Last path component, verbatim (keeps the '@' and case). Handles both '/' and '\' regardless of host OS so a mount-path string round-trips identically everywhere (mount paths are native — '\' on Windows — but the unit tests pin both forms).

Source from the content-addressed store, hash-verified

78// Last path component, verbatim (keeps the '@' and case). Handles both '/' and '\'
79// regardless of host OS so a mount-path string round-trips identically everywhere
80// (mount paths are native — '\' on Windows — but the unit tests pin both forms).
81std::string FolderBasename(const std::string& path)
82{
83 std::string p = path;
84 while (!p.empty() && (p.back() == '/' || p.back() == '\\'))
85 p.pop_back();
86 const std::size_t slash = p.find_last_of("/\\");
87 return (slash == std::string::npos) ? p : p.substr(slash + 1);
88}
89
90std::string Trim(std::string s)

Callers 1

ActiveModsFromMountPathFunction · 0.85

Calls 1

emptyMethod · 0.45

Tested by

no test coverage detected