eat up extra /'s as needed when included in the path

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@97 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
imaginos
2005-04-04 04:46:59 +00:00
parent 097b281ed3
commit 90c8d1179c

View File

@@ -162,9 +162,16 @@ int CUtils::MakeDir(const string& sPath, mode_t iMode) {
if (iFind == string::npos) {
return mkdir(sDir.c_str(), iMode);
}
iFind++;
string sWorkDir = sDir.substr(0, iFind + 1); // include the trailing slash
string sNewDir = sDir.erase(0, iFind + 1);
while( ( iFind < sDir.length() ) && ( sDir[iFind] == '/' ) )
iFind++; // eat up extra /'s
if ( iFind >= sDir.length() )
return mkdir(sDir.c_str(), iMode);
string sWorkDir = sDir.substr(0, iFind); // include the trailing slash
string sNewDir = sDir.erase(0, iFind);
struct stat st;