diff options
author | Vincent Richard <[email protected]> | 2004-12-23 13:46:45 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2004-12-23 13:46:45 +0000 |
commit | e32a8a5e1acf7d4ae011a9c9a022adfae2ebf7aa (patch) | |
tree | 4e70536389c1d7ea02e0466500f4bd2d9f7c1299 /src/messaging/maildirStore.cpp | |
parent | Hide private class 'IMAPauthenticator' from class documentation. (diff) | |
download | vmime-e32a8a5e1acf7d4ae011a9c9a022adfae2ebf7aa.tar.gz vmime-e32a8a5e1acf7d4ae011a9c9a022adfae2ebf7aa.zip |
When connecting, create root directory if it does not exists.
Diffstat (limited to 'src/messaging/maildirStore.cpp')
-rw-r--r-- | src/messaging/maildirStore.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/messaging/maildirStore.cpp b/src/messaging/maildirStore.cpp index 206c032b..a74e4c7d 100644 --- a/src/messaging/maildirStore.cpp +++ b/src/messaging/maildirStore.cpp @@ -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; } |