4 #include <msp/core/systemerror.h>
11 int stat(const Path &fn, struct stat &st)
13 return ::stat(fn.str().c_str(), &st);
16 struct stat stat(const Path &fn)
20 throw system_error("stat");
24 int lstat(const Path &fn, struct stat &st)
29 return ::lstat(fn.str().c_str(), &st);
33 struct stat lstat(const Path &fn)
37 throw system_error("lstat");
41 bool exists(const Path &path)
43 return access(path.str().c_str(), F_OK)==0;
46 bool is_reg(const Path &path)
50 return S_ISREG(st.st_mode);
54 bool is_dir(const Path &path)
58 return S_ISDIR(st.st_mode);
62 bool is_link(const Path &path)
68 if(lstat(path, st)==0)
69 return S_ISLNK(st.st_mode);