returns just extension of the provided filename (if any). */
| 146 | |
| 147 | /** returns just extension of the provided filename (if any). */ |
| 148 | std::string Path_GetExtension( const std::string & sPath ) |
| 149 | { |
| 150 | for ( std::string::const_reverse_iterator i = sPath.rbegin(); i != sPath.rend(); i++ ) |
| 151 | { |
| 152 | if ( *i == '.' ) |
| 153 | { |
| 154 | return std::string( i.base(), sPath.end() ); |
| 155 | } |
| 156 | |
| 157 | // if we find a slash there is no extension |
| 158 | if ( *i == '\\' || *i == '/' ) |
| 159 | break; |
| 160 | } |
| 161 | |
| 162 | // we didn't find an extension |
| 163 | return ""; |
| 164 | } |
| 165 | |
| 166 | bool Path_IsAbsolute( const std::string & sPath ) |
| 167 | { |