comparison Core/FileStorage/FilesystemStorage.cpp @ 1397:704de8c30ff5

modularization
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Jun 2015 11:50:58 +0200
parents 6e7e5ed91c2d
children f967bdf8534e
comparison
equal deleted inserted replaced
1396:ac4efabeb80c 1397:704de8c30ff5
39 #include "../OrthancException.h" 39 #include "../OrthancException.h"
40 #include "../Toolbox.h" 40 #include "../Toolbox.h"
41 #include "../Uuid.h" 41 #include "../Uuid.h"
42 42
43 #include <boost/filesystem/fstream.hpp> 43 #include <boost/filesystem/fstream.hpp>
44
45 #if HAVE_GOOGLE_LOG == 1
44 #include <glog/logging.h> 46 #include <glog/logging.h>
47 #endif
45 48
46 static std::string ToString(const boost::filesystem::path& p) 49 static std::string ToString(const boost::filesystem::path& p)
47 { 50 {
48 #if BOOST_HAS_FILESYSTEM_V3 == 1 51 #if BOOST_HAS_FILESYSTEM_V3 == 1
49 return p.filename().string(); 52 return p.filename().string();
80 FilesystemStorage::FilesystemStorage(std::string root) 83 FilesystemStorage::FilesystemStorage(std::string root)
81 { 84 {
82 //root_ = boost::filesystem::absolute(root).string(); 85 //root_ = boost::filesystem::absolute(root).string();
83 root_ = root; 86 root_ = root;
84 87
85 Toolbox::CreateDirectory(root); 88 Toolbox::MakeDirectory(root);
86 } 89 }
87 90
88 void FilesystemStorage::Create(const std::string& uuid, 91 void FilesystemStorage::Create(const std::string& uuid,
89 const void* content, 92 const void* content,
90 size_t size, 93 size_t size,
210 213
211 214
212 void FilesystemStorage::Remove(const std::string& uuid, 215 void FilesystemStorage::Remove(const std::string& uuid,
213 FileContentType /*type*/) 216 FileContentType /*type*/)
214 { 217 {
218 #if HAVE_GOOGLE_LOG == 1
215 LOG(INFO) << "Deleting file " << uuid; 219 LOG(INFO) << "Deleting file " << uuid;
220 #endif
221
216 namespace fs = boost::filesystem; 222 namespace fs = boost::filesystem;
217 223
218 fs::path p = GetPath(uuid); 224 fs::path p = GetPath(uuid);
219 225
220 try 226 try