Added check of account directory (check for missing subdirectories) in RsInit::InitRetroShare

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8362 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-06-03 23:03:03 +00:00
parent 00921b969e
commit 70d37d0306
3 changed files with 20 additions and 2 deletions

View File

@ -102,6 +102,15 @@ void RsAccountsDetail::unlockPreferredAccount()
mAccountsLocked = false; mAccountsLocked = false;
} }
bool RsAccountsDetail::checkAccountDirectory()
{
if (!checkPreferredId())
{
return false;
}
return setupAccount(PathAccountDirectory());
}
bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString) bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString)
{ {

View File

@ -71,6 +71,7 @@ class RsAccountsDetail
bool loadAccounts(); bool loadAccounts();
bool lockPreferredAccount(); bool lockPreferredAccount();
void unlockPreferredAccount(); void unlockPreferredAccount();
bool checkAccountDirectory();
// Paths. // Paths.
static std::string PathDataDirectory(); static std::string PathDataDirectory();

View File

@ -488,7 +488,6 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
// Hash the main executable. // Hash the main executable.
uint64_t tmp_size ; uint64_t tmp_size ;
std::string tmp_name ;
if(!RsDirUtil::getFileHash(argv[0],rsInitConfig->main_executable_hash,tmp_size,NULL)) if(!RsDirUtil::getFileHash(argv[0],rsInitConfig->main_executable_hash,tmp_size,NULL))
std::cerr << "Cannot hash executable! Plugins will not be loaded correctly." << std::endl; std::cerr << "Cannot hash executable! Plugins will not be loaded correctly." << std::endl;
@ -984,6 +983,15 @@ int RsServer::StartupRetroShare()
flags |= PQIPERSON_NO_LISTENER; flags |= PQIPERSON_NO_LISTENER;
} }
/* check account directory */
if (!rsAccounts->checkAccountDirectory())
{
std::cerr << "RsServer::StartupRetroShare() - Fatal Error....." << std::endl;
std::cerr << "checkAccount failed!" << std::endl;
std::cerr << std::endl;
return 0;
}
/**************************************************************************/ /**************************************************************************/
// Load up Certificates, and Old Configuration (if present) // Load up Certificates, and Old Configuration (if present)
std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl; std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl;