Mercurial > hg > orthanc
diff Core/FileStorage/FilesystemStorage.cpp @ 1135:67c3c1e4a6e0
index-only mode, and custom storage area with plugins
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 09 Sep 2014 15:55:43 +0200 |
parents | bf67431a7383 |
children | 2ffe07abd9d8 |
line wrap: on
line diff
--- a/Core/FileStorage/FilesystemStorage.cpp Tue Sep 09 12:53:49 2014 +0200 +++ b/Core/FileStorage/FilesystemStorage.cpp Tue Sep 09 15:55:43 2014 +0200 @@ -85,26 +85,20 @@ Toolbox::CreateDirectory(root); } - std::string FilesystemStorage::Create(const void* content, - size_t size, - FileContentType /*type*/) + void FilesystemStorage::Create(const std::string& uuid, + const void* content, + size_t size, + FileContentType /*type*/) { - std::string uuid; boost::filesystem::path path; - for (;;) - { - uuid = Toolbox::GenerateUuid(); - path = GetPath(uuid); + path = GetPath(uuid); - if (!boost::filesystem::exists(path)) - { - // OK, this is indeed a new file - break; - } - - // Extremely improbable case: This Uuid has already been created - // in the past. Try again. + if (boost::filesystem::exists(path)) + { + // Extremely unlikely case: This Uuid has already been created + // in the past. + throw OrthancException(ErrorCode_InternalError); } if (boost::filesystem::exists(path.parent_path())) @@ -140,8 +134,6 @@ } f.close(); - - return uuid; }