10 string Dirname(const string &path) {
11 char *str(new char[path.size() + 1]);
12 std::memcpy(str, path.c_str(), path.size());
13 str[path.size()] = '\0';
14 string dn(dirname(str));
19 string CatPath(const string &lhs, const string &rhs) {
22 && path[path.size() - 1] != '/'
23 && path[path.size() - 1] != '\\') {
26 if (!rhs.empty() && (rhs[0] == '/' || rhs[0] == '\\')) {
27 path.append(rhs, 1, string::npos);