Boost logo

Boost :

From: Jim Douglas (jim_at_[hidden])
Date: 2005-12-20 03:37:39


This section in operations.cpp fails to compile -

       BOOST_FILESYSTEM_DECL boost::filesystem::system_error_type
       remove_api( const std::string & ph )
       {
# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh)
|| defined(__APPLE__) || defined(__APPLE_CC__)))
         // Some Metrowerks C library versions fail on directories
because of a
         // known Metrowerks coding error in ::remove. Workaround is to call
         // rmdir() or unlink() as indicated.
         // Same bug also reported for QNX, with the same fix.
         if ( (is_directory( ph )
           ? ::rmdir( ph.string().c_str() ) // **ERROR**
           : ::unlink( ph.string().c_str() )) != 0 ) // **ERROR**
# else

'ph' is now std::string (it was a locally defined type 'path') and does
not have a member function 'string()'. I suspect this is a hangover from
the previous implementation. Should those lines perhaps now be -

         if ( (is_directory( ph )
           ? ::rmdir( ph.c_str() )
           : ::unlink( ph.c_str() )) != 0 )

  *********************************************************************

This section near the end of operations.cpp completely defeats QNX6 as
struct dirent does not have a member called d_type.

# ifdef BOOST_FILESYSTEM_STATUS_CACHE
         ...
         if ( entry.d_type == DT_DIR ) sf = symlink_sf = fs::directory_flag;
         else if ( entry.d_type == DT_REG ) sf = symlink_sf = fs::file_flag;
         else if ( entry.d_type == DT_LNK )
           { sf = 0; symlink_sf = fs::symlink_flag; }
         else sf = symlink_sf = fs::other_flag;
# else

QNX does embody tests to determine the file (hence directory) type but
they are based on a call to "stat( const char *path, struct stat buf )"
and inspecting buf.st_mode with pre-defined macros e.g "S_IFDIR(
buf.st_mode )" returns 1 if 'path' is a directory. This may be more
portable?

************************************************************************

I am experiencing a blizzard of "comparison between signed and unsigned"
warnings originating from path.hpp. They start at line 768 and they
occur each time "size" is compared against a constant value. Sorry, I am
not sure how to get rid of these warnings (in a portable way), but it
would be a relief if they were to disappear :-)

HTH
Jim Douglas


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk