]> pilppa.org Git - libplp.git/blobdiff - src/FileUtil.hh
w1 independent file cleanups.
[libplp.git] / src / FileUtil.hh
diff --git a/src/FileUtil.hh b/src/FileUtil.hh
new file mode 100644 (file)
index 0000000..e69ada8
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * FileUtil.hh
+ *
+ *  Created on: Mar 5, 2011
+ *      Author: lamikr
+ */
+
+#ifndef FILEUTIL_HH_
+#define FILEUTIL_HH_
+
+#include <string>
+#include <vector>
+
+#include <dirent.h>
+
+namespace plp {
+       class FileUtil {
+               public:
+                       FileUtil();
+                       virtual ~FileUtil();
+                       static std::string concat_paths(std::string path_start, std::string path_end);
+                       static std::string concat_paths(const char *path_start, const char *path_end);
+                       static bool is_subdirectory(const char *path, dirent *direntry);
+                       static bool is_datafile(const char *path, dirent *direntry);
+                       static std::vector<std::string> get_subdirectories(const std::string& path);
+                       static std::vector<std::string> get_data_files(const std::string& path);
+                       static char *parse_directory_path(const char *file_path);
+                       static bool mkdirs(const char *path);
+                       static std::ofstream *open_for_writing(const char *path);
+       };
+}
+
+#endif /* FILEUTIL_HH_ */