comparison Core/FileStorage/FilesystemStorage.cpp @ 2140:aa4b8895cd23

reorganization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 Nov 2016 16:12:47 +0100
parents 0c09d1af22f3
children 5a8840920121
comparison
equal deleted inserted replaced
2139:764c9157301b 2140:aa4b8895cd23
81 FilesystemStorage::FilesystemStorage(std::string root) 81 FilesystemStorage::FilesystemStorage(std::string root)
82 { 82 {
83 //root_ = boost::filesystem::absolute(root).string(); 83 //root_ = boost::filesystem::absolute(root).string();
84 root_ = root; 84 root_ = root;
85 85
86 Toolbox::MakeDirectory(root); 86 SystemToolbox::MakeDirectory(root);
87 } 87 }
88 88
89 89
90 90
91 static const char* GetDescriptionInternal(FileContentType content) 91 static const char* GetDescriptionInternal(FileContentType content)
141 { 141 {
142 throw OrthancException(ErrorCode_FileStorageCannotWrite); 142 throw OrthancException(ErrorCode_FileStorageCannotWrite);
143 } 143 }
144 } 144 }
145 145
146 Toolbox::WriteFile(content, size, path.string()); 146 SystemToolbox::WriteFile(content, size, path.string());
147 } 147 }
148 148
149 149
150 void FilesystemStorage::Read(std::string& content, 150 void FilesystemStorage::Read(std::string& content,
151 const std::string& uuid, 151 const std::string& uuid,
153 { 153 {
154 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type) 154 LOG(INFO) << "Reading attachment \"" << uuid << "\" of \"" << GetDescriptionInternal(type)
155 << "\" content type"; 155 << "\" content type";
156 156
157 content.clear(); 157 content.clear();
158 Toolbox::ReadFile(content, GetPath(uuid).string()); 158 SystemToolbox::ReadFile(content, GetPath(uuid).string());
159 } 159 }
160 160
161 161
162 uintmax_t FilesystemStorage::GetSize(const std::string& uuid) const 162 uintmax_t FilesystemStorage::GetSize(const std::string& uuid) const
163 { 163 {
175 175
176 if (fs::exists(root_) && fs::is_directory(root_)) 176 if (fs::exists(root_) && fs::is_directory(root_))
177 { 177 {
178 for (fs::recursive_directory_iterator current(root_), end; current != end ; ++current) 178 for (fs::recursive_directory_iterator current(root_), end; current != end ; ++current)
179 { 179 {
180 if (Toolbox::IsRegularFile(current->path().string())) 180 if (SystemToolbox::IsRegularFile(current->path().string()))
181 { 181 {
182 try 182 try
183 { 183 {
184 fs::path d = current->path(); 184 fs::path d = current->path();
185 std::string uuid = ToString(d); 185 std::string uuid = ToString(d);