sanitize indent so that I can work with this code
authorGerd von Egidy <gerd.von.egidy@intra2net.com>
Wed, 16 Dec 2015 22:36:50 +0000 (23:36 +0100)
committerGerd von Egidy <gerd.von.egidy@intra2net.com>
Wed, 16 Dec 2015 22:36:50 +0000 (23:36 +0100)
src/filefunc.cpp

index 3a7f7c1..c71b27d 100644 (file)
@@ -747,51 +747,55 @@ bool recursive_delete(const std::string &path,
 {
     bool rtn = true;
 
-    try {
+    try
+    {
         struct stat my_stat;
-        if (stat(path.c_str(), &my_stat) != 0) {
+        if (stat(path.c_str(), &my_stat) != 0)
             throw runtime_error("can't stat " + path);
-        }
 
-        if (S_ISDIR(my_stat.st_mode)) {
+        if (S_ISDIR(my_stat.st_mode))
+        {
             DIR *dir = opendir(path.c_str());
-            if (!dir) {
+            if (!dir)
                 throw runtime_error("can't open directory " + path);
-            }
 
             struct dirent store, *entry = NULL;
             while (readdir_r(dir, &store, &entry) == 0 && entry != NULL)
             {
                 string filename = entry->d_name;
-                if (filename == "." || filename == "..") {
+                if (filename == "." || filename == "..")
                     continue;
-                }
 
                 // Delete subdir or file.
                 rtn = recursive_delete(path + "/" + filename, false, error);
-                if (rtn == false) {
+                if (rtn == false)
                     break;
-                }
             }
 
             closedir(dir);
-            if (keep_parent_dir == false && !rmdir(path)) {
+            if (keep_parent_dir == false && !rmdir(path))
                 throw runtime_error("can't remove directory " + path);
-            }
-        } else {
-            if (!unlink(path)) {
+        }
+        else
+        {
+            if (!unlink(path))
                 throw runtime_error("can't unlink " + path);
-            }
         }
-    } catch (exception &e) {
-        if (error) {
+    }
+    catch (exception &e)
+    {
+        if (error)
+        {
             ostringstream out;
             out << e.what() << " (" << strerror(errno) << ")";
             *error = out.str();
         }
         rtn = false;
-    } catch (...) {
-        if (error) {
+    }
+    catch (...)
+    {
+        if (error)
+        {
             ostringstream out;
             out << "unknown error (" << strerror(errno) << ")";
             *error = out.str();