summaryrefslogtreecommitdiff
path: root/node/Utils.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Utils.hpp')
-rw-r--r--node/Utils.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/node/Utils.hpp b/node/Utils.hpp
index a222ca4f..872201f8 100644
--- a/node/Utils.hpp
+++ b/node/Utils.hpp
@@ -43,6 +43,12 @@
#include "../ext/lz4/lz4.h"
#include "../ext/lz4/lz4hc.h"
+#ifdef __WINDOWS__
+#include <windows.h>
+#else
+#include <unistd.h>
+#endif
+
#include "Constants.hpp"
/**
@@ -59,6 +65,27 @@ class Utils
{
public:
/**
+ * Delete a file
+ *
+ * @param path Path to delete
+ * @return True if delete was successful
+ */
+ static inline bool rm(const char *path)
+ throw()
+ {
+#ifdef __WINDOWS__
+ foo;
+#else
+ return (unlink(path) == 0);
+#endif
+ }
+ static inline bool rm(const std::string &path)
+ throw()
+ {
+ return rm(path.c_str());
+ }
+
+ /**
* List a directory's contents
*
* @param path Path to list