Boost logo

Boost Users :

From: Sebastien Martel (smartel_at_[hidden])
Date: 2005-03-15 18:58:55


Hello,

      The windows implementation for find_first_file is flawed for
      windows 98. The problem is appending \* to the dir path: this is
      not supported for win98.

      Here is a possible fix that has been working for me quite well.
      
    inline const char * find_first_file( const char * dir,
        BOOST_HANDLE & handle, BOOST_SYSTEM_DIRECTORY_TYPE & data )
    {
    // std::cout << "find_first_file " << dir << std::endl;

        // \* is not supported on win98
        //std::string dirpath( std::string(dir) + "\\*" );

        std::string dirpath( dir );
        dirpath += ( dirpath.empty() || dirpath[dirpath.size()-1] != '\\' ) ? "\\*" : "*";

        return ( (handle = ::FindFirstFileA( dirpath.c_str(), &data ))
        == BOOST_INVALID_HANDLE_VALUE ) ? 0 : data.cFileName;
    }
  

-- 
Best regards,
 Sebastien                          mailto:smartel_at_[hidden]

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net