<commit_before>#include <osgDB/FileNameUtils>


// mac requires std::tolower, but IRIX MipsPro doesn't like it,
// so use this preprocessor to allow mac and mipspro to work.
#ifdef macintosh
using std::tolower;
using std::strlen;
#endif

std::string osgDB::getFilePath(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    if (slash==std::string::npos) return std::string("");
    return std::string(fileName.begin(),fileName.begin()+slash+1);
}


std::string osgDB::getSimpleFileName(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    if (slash==std::string::npos) return fileName;
    return std::string(fileName.begin()+slash+1,fileName.end());
}


std::string osgDB::getFileExtension(const std::string& fileName)
{
    std::string::size_type dot = fileName.find_last_of('.');
    if (dot==std::string::npos) return std::string("");
    return std::string(fileName.begin()+dot+1,fileName.end());
}


std::string osgDB::getLowerCaseFileExtension(const std::string& filename)
{
    std::string ext = osgDB::getFileExtension(filename);
    for(std::string::iterator itr=ext.begin();
        itr!=ext.end();
        ++itr)
    {
        *itr = tolower(*itr);
    }
    return ext;
}


std::string osgDB::getStrippedName(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    std::string::size_type dot = fileName.find_last_of('.');
    if (slash==std::string::npos)
    {
        if (dot==std::string::npos) return fileName;
        else return std::string(fileName.begin(),fileName.begin()+dot);
    }
    else
    {
        if (dot==std::string::npos) return std::string(fileName.begin()+slash+1,fileName.end());
        else return std::string(fileName.begin()+slash+1,fileName.begin()+dot);
    }
}


bool osgDB::equalCaseInsensitive(const std::string& lhs,const std::string& rhs)
{
    if (lhs.size()!=rhs.size()) return false;
    std::string::const_iterator litr = lhs.begin();
    std::string::const_iterator ritr = rhs.begin();
    while (litr!=lhs.end())
    {<commit_msg>Fix to osgDB::getStrippedName(..) so that handles the case of file without an extension.<commit_after>#include <osgDB/FileNameUtils>


// mac requires std::tolower, but IRIX MipsPro doesn't like it,
// so use this preprocessor to allow mac and mipspro to work.
#ifdef macintosh
using std::tolower;
using std::strlen;
#endif

std::string osgDB::getFilePath(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    if (slash==std::string::npos) return std::string("");
    return std::string(fileName.begin(),fileName.begin()+slash+1);
}


std::string osgDB::getSimpleFileName(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    if (slash==std::string::npos) return fileName;
    return std::string(fileName.begin()+slash+1,fileName.end());
}


std::string osgDB::getFileExtension(const std::string& fileName)
{
    std::string::size_type dot = fileName.find_last_of('.');
    if (dot==std::string::npos) return std::string("");
    return std::string(fileName.begin()+dot+1,fileName.end());
}


std::string osgDB::getLowerCaseFileExtension(const std::string& filename)
{
    std::string ext = osgDB::getFileExtension(filename);
    for(std::string::iterator itr=ext.begin();
        itr!=ext.end();
        ++itr)
    {
        *itr = tolower(*itr);
    }
    return ext;
}


std::string osgDB::getStrippedName(const std::string& fileName)
{
    std::string::size_type slash = fileName.find_last_of('/');
    std::string::size_type dot = fileName.find_last_of('.');

    // Ignore '.'s that aren't in the last component
    if (slash != std::string::npos && dot < slash)
      dot = std::string::npos;

    if (slash==std::string::npos)
    {
        if (dot==std::string::npos) return fileName;
        else return std::string(fileName.begin(),fileName.begin()+dot);
    }
    else
    {
        if (dot==std::string::npos) return std::string(fileName.begin()+slash+1,fileName.end());
        else return std::string(fileName.begin()+slash+1,fileName.begin()+dot);
    }
}


bool osgDB::equalCaseInsensitive(const std::string& lhs,const std::string& rhs)
{
    if (lhs.size()!=rhs.size()) return false;
    std::string::const_iterator litr = lhs.begin();
    std::string::const_iterator ritr = rhs.begin();
    while (litr!=lhs.end())
    {
{'fraction_non_alphanumeric': 0.1764970733903647, 'fraction_numerical': 0.0022512381809995496, 'mean_word_length': 4.616940581542352, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2984144', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1518, 'n_words': 283}