Check for both forward and back slashes in the windows version of util::DirName

Originally committed to SVN as r4792.
This commit is contained in:
Thomas Goyne 2010-10-07 17:18:00 +00:00
parent 1dedfb18cd
commit 682fd9406c

View file

@ -39,11 +39,12 @@ namespace agi {
using agi::charset::ConvertW; using agi::charset::ConvertW;
const std::string DirName(const std::string& path) { const std::string DirName(const std::string& path) {
if (path.find('/') == std::string::npos) { std::string::size_type pos = path.rfind('/');
return ".";
}
return path.substr(0, path.rfind("/")+1); if (pos == std::string::npos) pos = path.rfind('\\');
if (pos == std::string::npos) return ".";
return path.substr(0, pos+1);
} }
void Rename(const std::string& from, const std::string& to) { void Rename(const std::string& from, const std::string& to) {