diff --git a/libretroshare/src/rsserver/rsaccounts.cc b/libretroshare/src/rsserver/rsaccounts.cc index 0f9a66b80..586eeb49d 100644 --- a/libretroshare/src/rsserver/rsaccounts.cc +++ b/libretroshare/src/rsserver/rsaccounts.cc @@ -101,7 +101,16 @@ void RsAccountsDetail::unlockPreferredAccount() { mAccountsLocked = false; } - + +bool RsAccountsDetail::checkAccountDirectory() +{ + if (!checkPreferredId()) + { + return false; + } + + return setupAccount(PathAccountDirectory()); +} bool RsAccountsDetail::selectAccountByString(const std::string &prefUserString) { diff --git a/libretroshare/src/rsserver/rsaccounts.h b/libretroshare/src/rsserver/rsaccounts.h index 351d900c4..13ee2c4b9 100644 --- a/libretroshare/src/rsserver/rsaccounts.h +++ b/libretroshare/src/rsserver/rsaccounts.h @@ -71,6 +71,7 @@ class RsAccountsDetail bool loadAccounts(); bool lockPreferredAccount(); void unlockPreferredAccount(); + bool checkAccountDirectory(); // Paths. static std::string PathDataDirectory(); diff --git a/libretroshare/src/rsserver/rsinit.cc b/libretroshare/src/rsserver/rsinit.cc index 648ef38b5..f9147a7bb 100644 --- a/libretroshare/src/rsserver/rsinit.cc +++ b/libretroshare/src/rsserver/rsinit.cc @@ -488,7 +488,6 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck // Hash the main executable. uint64_t tmp_size ; - std::string tmp_name ; 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; @@ -984,6 +983,15 @@ int RsServer::StartupRetroShare() 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) std::cerr << "Load up Certificates, and Old Configuration (if present)." << std::endl;