comparison Core/FileStorage.cpp @ 147:7e8b68dd6ace

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Oct 2012 18:02:23 +0200
parents e7e19f042eb5
children 0fadb04728ba
comparison
equal deleted inserted replaced
146:c7f1cea08f6f 147:7e8b68dd6ace
276 void FileStorage::Remove(const std::string& uuid) 276 void FileStorage::Remove(const std::string& uuid)
277 { 277 {
278 namespace fs = boost::filesystem; 278 namespace fs = boost::filesystem;
279 279
280 fs::path p = GetPath(uuid); 280 fs::path p = GetPath(uuid);
281 fs::remove(p); 281
282 try
283 {
284 fs::remove(p);
285 }
286 catch (fs::filesystem_error)
287 {
288 // Ignore the error
289 }
282 290
283 // Remove the two parent directories, ignoring the error code if 291 // Remove the two parent directories, ignoring the error code if
284 // these directories are not empty 292 // these directories are not empty
285 293
294 try
295 {
286 #if BOOST_HAS_FILESYSTEM_V3 == 1 296 #if BOOST_HAS_FILESYSTEM_V3 == 1
287 boost::system::error_code err; 297 boost::system::error_code err;
288 fs::remove(p.parent_path(), err); 298 fs::remove(p.parent_path(), err);
289 fs::remove(p.parent_path().parent_path(), err); 299 fs::remove(p.parent_path().parent_path(), err);
290 #else 300 #else
291 fs::remove(p.parent_path()); 301 fs::remove(p.parent_path());
292 fs::remove(p.parent_path().parent_path()); 302 fs::remove(p.parent_path().parent_path());
293 #endif 303 #endif
294 } 304 }
295 305 catch (fs::filesystem_error)
296 void FileStorage::UncheckedRemove(const std::string& uuid)
297 {
298 try
299 {
300 Remove(uuid);
301 }
302 catch (boost::filesystem::filesystem_error)
303 { 306 {
304 // Ignore the error 307 // Ignore the error
305 } 308 }
306 } 309 }
307 310
308 311
309
310 uintmax_t FileStorage::GetCapacity() const 312 uintmax_t FileStorage::GetCapacity() const
311 { 313 {
312 return boost::filesystem::space(root_).capacity; 314 return boost::filesystem::space(root_).capacity;
313 } 315 }
314 316