try
{
- struct stat my_stat;
- if (stat(path.c_str(), &my_stat) != 0)
+ Stat sp(path, false);
+ if (!sp)
throw runtime_error("can't stat " + path);
- if (S_ISDIR(my_stat.st_mode))
+ if (sp.is_directory())
{
DIR *dir = opendir(path.c_str());
if (!dir)