std::string FileSystemAbstraction::GetParent(const std::string& path) { std::string parent = path; EnsureNoPathSepAtEnd(parent); static const char* PATH_SEP_REGEX = sPS_POSIX sPS_WIN32; const std::string::size_type slashPos = parent.find_last_of(PATH_SEP_REGEX); if (slashPos == std::string::npos) { parent = ""; } else { parent.resize(slashPos + 1); } return parent; }
std::string FileSystemAbstraction::EnsureNoPathSepAtEnd(const std::string& path) { std::string pathCopy(path); EnsureNoPathSepAtEnd(pathCopy); return pathCopy; }
std::string FileSystemHandler::EnsureNoPathSepAtEnd(const std::string& path) { std::string pathCopy(path); EnsureNoPathSepAtEnd(pathCopy); return pathCopy; }