When connecting, create root directory if it does not exists.

This commit is contained in:
Vincent Richard 2004-12-23 13:46:45 +00:00
parent cb600c3373
commit e32a8a5e1a
2 changed files with 25 additions and 2 deletions

View File

@ -2,6 +2,11 @@
VERSION 0.6.1-cvs
=================
2004-12-23 Vincent Richard <vincent@vincent-richard.net>
* maildir: when connecting to the store, create root directory on the
file system if it does not exist.
2004-12-22 Vincent Richard <vincent@vincent-richard.net>
* Fixed missing files in distribution (src/platform/*).

View File

@ -102,8 +102,26 @@ void maildirStore::connect()
if (isConnected())
throw exceptions::already_connected();
m_fsPath = platformDependant::getHandler()->getFileSystemFactory()->
stringToPath(getSession()->getProperties()[getInfos().getPropertyPrefix() + "server.rootpath"]);
// Get root directory
utility::fileSystemFactory* fsf = platformDependant::getHandler()->getFileSystemFactory();
m_fsPath = fsf->stringToPath
(getSession()->getProperties()[getInfos().getPropertyPrefix() + "server.rootpath"]);
utility::auto_ptr <utility::file> rootDir = fsf->create(m_fsPath);
// Try to create the root directory if it does not exist
if (!(rootDir->exists() && rootDir->isDirectory()))
{
try
{
rootDir->createDirectory();
}
catch (exceptions::filesystem_exception& e)
{
throw exceptions::connection_error(e);
}
}
m_connected = true;
}