Added check for trailing '/' of base directory in RsAccountsDetail::setupBaseDirectory.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8464 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-15 12:46:04 +00:00
parent dd25e5dc31
commit 6a778ab904

View File

@ -299,6 +299,20 @@ bool RsAccountsDetail::setupBaseDirectory(std::string alt_basedir)
mBaseDirectory = alt_basedir; mBaseDirectory = alt_basedir;
} }
/* Check for trailing '/' */
if (!mBaseDirectory.empty())
{
char lastChar = *mBaseDirectory.rbegin();
if (lastChar == '/'
#ifdef WINDOWS_SYS
|| lastChar == '\\'
#endif
)
{
mBaseDirectory.erase(mBaseDirectory.end() - 1);
}
}
if (!RsDirUtil::checkCreateDirectory(mBaseDirectory)) if (!RsDirUtil::checkCreateDirectory(mBaseDirectory))
{ {
std::cerr << "RsAccounts::setupBaseDirectory() Cannot Create BaseConfig Dir:" << mBaseDirectory; std::cerr << "RsAccounts::setupBaseDirectory() Cannot Create BaseConfig Dir:" << mBaseDirectory;