#include <aclapi.h>
#else
#define _FILE_OFFSET_BITS 64
+#include <cerrno>
+#include <unistd.h>
#include <sys/stat.h>
#include <grp.h>
#include <pwd.h>
Stat Stat::Private::from_struct_stat(const struct stat &st)
{
Stat result;
+ result.exists = true;
if(S_ISREG(st.st_mode))
result.type = REGULAR;
else if(S_ISDIR(st.st_mode))
#endif
Stat::Stat():
+ exists(false),
type(UNKNOWN),
size(0),
alloc_size(0)
struct stat st;
int ret = ::stat(path.str().c_str(), &st);
if(ret==-1)
- throw system_error("stat");
+ {
+ if(errno==ENOENT)
+ return Stat();
+ else
+ throw system_error("stat");
+ }
return Private::from_struct_stat(st);
#endif
struct stat st;
int ret = ::lstat(path.str().c_str(), &st);
if(ret==-1)
- throw system_error("lstat");
+ {
+ if(errno==ENOENT)
+ return Stat();
+ else
+ throw system_error("lstat");
+ }
return Private::from_struct_stat(st);
#endif