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
1 changed files with 5 additions and 4 deletions

View File

@ -39,11 +39,12 @@ namespace agi {
using agi::charset::ConvertW;
const std::string DirName(const std::string& path) {
if (path.find('/') == std::string::npos) {
return ".";
}
std::string::size_type pos = path.rfind('/');
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) {