|
Boost : |
From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-05-12 13:19:09
To nail down the semantics of status(), let's try a different approach.
Some of the difficulty may be a matter of miscommunication, so perhaps
actual code will add clarity.
Perhaps Peter or others who have views on what the semantics of
boost::filesystem::status() should be could change the code below to
implement those semantics. Hopefully that will eliminate any confusion as
to exactly meaning.
--Beman
---------
status_flag status_imp( const char * path, system_error_type * ec )
{
struct stat path_stat;
if ( ::stat( path, &path_stat ) != 0 )
{
if ( ec != 0 ) *ec = errno;
return ((errno == ENOENT) || (errno == ENOTDIR))
? fs::not_found_flag : fs::error_flag;
}
system_error_type result(0);
if ( S_ISDIR( path_stat.st_mode ) ) result |= fs::directory_flag;
if ( S_ISREG( path_stat.st_mode ) ) result |= fs::file_flag;
return result;
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk