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

Function Path_StripDirectory

samples/shared/pathtools.cpp:115–125  ·  view source on GitHub ↗

returns just the filename from the provided full or relative path. */

Source from the content-addressed store, hash-verified

113
114/** returns just the filename from the provided full or relative path. */
115std::string Path_StripDirectory( const std::string & sPath, char slash )
116{
117 if( slash == 0 )
118 slash = Path_GetSlash();
119
120 std::string::size_type n = sPath.find_last_of( slash );
121 if( n == std::string::npos )
122 return sPath;
123 else
124 return std::string( sPath.begin() + n + 1, sPath.end() );
125}
126
127/** returns just the filename with no extension of the provided filename.
128* If there is a path the path is left intact. */

Callers 1

Calls 3

beginMethod · 0.80
endMethod · 0.80
Path_GetSlashFunction · 0.70

Tested by

no test coverage detected