src/libtsduck/base/tsSysUtils.cpp
ts::UString ts::PathSuffix(const UString& path)
{
    UString::size_type sep = LastPathSeparator(path);
    UString::size_type dot = path.rfind(u'.');

    if (dot == NPOS) {
        return ts::UString();  // no dot in path
    }
    else if (sep != NPOS && dot < sep) {
        return ts::UString();  // dot in directory part, not in base name
    }
    else {
        return path.substr(dot); // dot in base name
    }
}
//----------------------------------------------------------------------------
// Return the suffix of a file path (eg. "dir/foo.bar" => ".bar")
//----------------------------------------------------------------------------
Return the suffix of a file path
Return the suffix of a file path
ts::UString ts::PathSuffix(const UString& path)
{
    UString::size_type sep = LastPathSeparator(path);
    UString::size_type dot = path.rfind(u'.');
    if (dot == NPOS) {
        return ts::UString();  
    }
    else if (sep != NPOS && dot < sep) {
        return ts::UString();  
    }
    else {
        return path.substr(dot); 
    }
}
ts :: UString ts :: PathSuffix ( const UString & path ) { UString :: size_type sep = LastPathSeparator ( path ) ; UString :: size_type dot = path . rfind ( u' ' ) ; if ( dot == NPOS ) { return ts :: UString ( ) ; } else if ( sep != NPOS && dot < sep ) { return ts :: UString ( ) ; } else { return path . substr ( dot ) ; } }
Return the suffix of a file path (eg.
Return the suffix of a file path ( eg .
// no dot in path // dot in directory part, not in base name // dot in base name