From 035345f13d2da9eced87a426a671d3bc4df392b5 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Wed, 26 Jan 2011 00:40:33 +0200 Subject: Map deletion button --- src/filesys.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'src/filesys.cpp') diff --git a/src/filesys.cpp b/src/filesys.cpp index a2d3f9d14..a025ec185 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -19,6 +19,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "filesys.h" #include +#include namespace fs { @@ -130,12 +131,35 @@ bool PathExists(std::string path) return (GetFileAttributes(path.c_str()) != INVALID_FILE_ATTRIBUTES); } +bool RecursiveDelete(std::string path) +{ + std::cerr<<"Removing \""< #include #include #include +#include std::vector GetDirListing(std::string pathstring) { @@ -184,7 +208,70 @@ bool PathExists(std::string path) return (stat(path.c_str(),&st) == 0); } +bool RecursiveDelete(std::string path) +{ + /* + Execute the 'rm' command directly, by fork() and execve() + */ + + std::cerr<<"Removing \""< list = GetDirListing(path); + for(unsigned int i=0; i