Boost logo

Boost :

From: Mike Morearty (mike_at_[hidden])
Date: 2000-01-11 15:29:15


Oops, one more correction.

Since Windows filenames are case-insensitive when comparing, the
"get<user_execute>()" function needs to do case-insensitive comparisons on
the filename's extension.

The easiest way to do that is by adding the following line to change the
"ext" variable to all lower-case:

    std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);

This means it will be necessary to add the following two include directives
to directory.cpp, just after the "#elif defined(BOOST_WINNT)":

    #include <ctype.h>
    #include <algorithm>

Here's the full text of the new "get<user_execute>()" function, with the
above line added:

template <> get<user_execute>::operator user_execute::value_type() const
{
    std::string name(*m_it);
    std::string::size_type dot = name.find_last_of('.');

    if (dot == std::string::npos)
        return false;
    else
        {
            std::string ext(name.substr(dot));
            std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
            return ext == ".exe" || ext == ".com" || ext == ".bat";
        }
}


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