#include <unistd.h>
#include <sys/stat.h>
#include <msp/core/systemerror.h>
+#include <msp/strings/format.h>
#include "stat.h"
#include "stat_private.h"
int ret = ::stat(path.str().c_str(), &st);
if(ret==-1)
{
- if(errno==ENOENT)
+ int err = errno;
+ if(err==ENOENT)
return Stat();
else
- throw system_error("stat");
+ throw system_error(format("stat(%s)", path), err);
}
return Private::from_struct_stat(st);
int ret = ::lstat(path.str().c_str(), &st);
if(ret==-1)
{
- if(errno==ENOENT)
+ int err = errno;
+ if(err==ENOENT)
return Stat();
else
- throw system_error("lstat");
+ throw system_error(format("lstat(%s)", path), err);
}
return Private::from_struct_stat(st);
if(err==ERROR_FILE_NOT_FOUND)
return Stat();
else
- throw system_error("CreateFile", err);
+ throw system_error(format("CreateFile(%s)", path), err);
}
BY_HANDLE_FILE_INFORMATION info;