MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / Path_StripExtension

Function Path_StripExtension

src/vrcore/pathtools_public.cpp:170–186  ·  view source on GitHub ↗

returns just the filename with no extension of the provided filename. * If there is a path the path is left intact. */

Source from the content-addressed store, hash-verified

168/** returns just the filename with no extension of the provided filename.
169* If there is a path the path is left intact. */
170std::string Path_StripExtension( const std::string & sPath )
171{
172 for( std::string::const_reverse_iterator i = sPath.rbegin(); i != sPath.rend(); i++ )
173 {
174 if( *i == '.' )
175 {
176 return std::string( sPath.begin(), i.base() - 1 );
177 }
178
179 // if we find a slash there is no extension
180 if( *i == '\\' || *i == '/' )
181 break;
182 }
183
184 // we didn't find an extension
185 return sPath;
186}
187
188/** returns just extension of the provided filename (if any). */
189std::string Path_GetExtension( const std::string & sPath )

Callers 1

Path_GetExecutableNameFunction · 0.70

Calls 1

beginMethod · 0.80

Tested by

no test coverage detected