--- /dev/null
+#include <cstdlib>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <msp/core/systemerror.h>
+#include "dir.h"
+
+using namespace std;
+
+namespace Msp {
+namespace FS {
+
+void mkdir(const Path &path, int mode)
+{
+ if(::mkdir(path.str().c_str(), mode)==-1)
+ throw system_error("mkdir");
+}
+
+void rmdir(const Path &path)
+{
+ if(::rmdir(path.str().c_str())==-1)
+ throw system_error("rmdir");
+}
+
+Path get_home_dir()
+{
+ const char *home = getenv("HOME");
+ if(home)
+ return home;
+ return ".";
+}
+
+Path get_user_data_dir(const string &appname)
+{
+ return get_home_dir()/("."+appname);
+}
+
+} // namespace FS
+} // namespace Msp