diff --git a/src/operations.cpp b/src/operations.cpp index 8809f5c..40a68e8 100644 --- a/src/operations.cpp +++ b/src/operations.cpp @@ -116,6 +116,7 @@ using std::wstring; # else # include # endif +# include // REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the // Windows Device Driver Kit. Since that's inconvenient, the definitions are provided @@ -1284,16 +1285,13 @@ namespace detail : path_stat.st_size == 0; # else - WIN32_FILE_ATTRIBUTE_DATA fad; - if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, - p, ec, "boost::filesystem::is_empty")) - return false; - - if (ec != 0) ec->clear(); - return - (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ? is_empty_directory(p) - : (!fad.nFileSizeHigh && !fad.nFileSizeLow); + struct _stat path_stat; + if (error(::_wstat(p.c_str(), &path_stat) != 0, + p, ec, "boost::filesystem::is_empty")) + return false; + return ((path_stat.st_mode & _S_IFDIR) != 0) + ? is_empty_directory(p) + : path_stat.st_size == 0; # endif }