4 #include <msp/core/systemerror.h>
5 #include <msp/strings/regex.h>
13 void mkdir(const Path &path, int mode)
15 if(::mkdir(path.str().c_str(), mode)==-1)
16 throw system_error("mkdir");
19 void rmdir(const Path &path)
21 if(::rmdir(path.str().c_str())==-1)
22 throw system_error("rmdir");
25 vector<string> list_filtered(const Path &path, const string &filter)
27 Regex r_filter(filter);
29 vector<string> result;
30 DIR *dir = opendir(path.str().c_str());
32 throw system_error("opendir");
34 while(dirent *de = readdir(dir))
36 const char *fn = de->d_name;
37 if(fn[0]=='.' && (fn[1]==0 || (fn[1]=='.' && fn[2]==0)))
39 if(r_filter.match(fn))
50 return ::getcwd(buf, sizeof(buf));
53 void chdir(const Path &path)
55 if(::chdir(path.str().c_str())==-1)
56 throw system_error("chdir");