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

Function Path_UrlToFilePath

src/vrcore/pathtools_public.cpp:908–922  ·  view source on GitHub ↗

----------------------------------------------------------------------------------------------------- Purpose: Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned -----------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

906// Purpose: Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned
907// -----------------------------------------------------------------------------------------------------
908std::string Path_UrlToFilePath( const std::string & sFileUrl )
909{
910 if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) )
911 {
912 char *pchBuffer = (char *)alloca( sFileUrl.length() );
913 V_URLDecodeNoPlusForSpace( pchBuffer, (int)sFileUrl.length(),
914 sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) );
915
916 return Path_FixSlashes( pchBuffer );
917 }
918 else
919 {
920 return "";
921 }
922}
923
924
925// -----------------------------------------------------------------------------------------------------

Callers

nothing calls this directly

Calls 4

strnicmpFunction · 0.70
Path_FixSlashesFunction · 0.70
lengthMethod · 0.45

Tested by

no test coverage detected