1 // file : cutl/fs/auto-remove.cxx 2 // copyright : Copyright (c) 2009-2017 Code Synthesis Tools CC 3 // license : MIT; see accompanying LICENSE file 4 5 #include <cstdio> // std::remove 6 #include <cerrno> 7 8 #include <cutl/fs/auto-remove.hxx> 9 10 namespace cutl 11 { 12 namespace fs 13 { 14 auto_remove:: ~auto_remove()15 ~auto_remove () 16 { 17 if (!canceled_) 18 std::remove (path_.string ().c_str ()); // Ignore error. 19 } 20 21 auto_removes:: ~auto_removes()22 ~auto_removes () 23 { 24 if (!canceled_) 25 { 26 for (paths::iterator i (paths_.begin ()); i != paths_.end (); ++i) 27 std::remove (i->string ().c_str ()); // Ignore error. 28 } 29 } 30 } 31 } 32