5 #include <msp/core/except.h>
12 int stat(const Path &fn, struct stat &st)
14 return ::stat(fn.str().c_str(), &st);
17 struct stat stat(const Path &fn)
21 throw SystemError("stat failed", errno);
25 int lstat(const Path &fn, struct stat &st)
30 return ::lstat(fn.str().c_str(), &st);
34 struct stat lstat(const Path &fn)
38 throw SystemError("lstat failed", errno);
42 bool exists(const Path &path)
44 return access(path.str().c_str(), F_OK)==0;
47 bool is_reg(const Path &path)
51 return S_ISREG(st.st_mode);
55 bool is_dir(const Path &path)
59 return S_ISDIR(st.st_mode);
63 bool is_link(const Path &path)
69 if(lstat(path, st)==0)
70 return S_ISLNK(st.st_mode);