---------------------------------------------------------------------------------------------------------------------------- Purpose: Turns a path to a file on disk into a URL (or just returns the value if it's already a URL) ----------------------------------------------------------------------------------------------------------------------------
| 745 | // Purpose: Turns a path to a file on disk into a URL (or just returns the value if it's already a URL) |
| 746 | // ---------------------------------------------------------------------------------------------------------------------------- |
| 747 | std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath ) |
| 748 | { |
| 749 | if ( !strnicmp( sRelativePath.c_str(), "http://", 7 ) |
| 750 | || !strnicmp( sRelativePath.c_str(), "https://", 8 ) |
| 751 | || !strnicmp( sRelativePath.c_str(), "file://", 7 ) ) |
| 752 | { |
| 753 | return sRelativePath; |
| 754 | } |
| 755 | else |
| 756 | { |
| 757 | std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath ); |
| 758 | if ( sAbsolute.empty() ) |
| 759 | return sAbsolute; |
| 760 | sAbsolute = Path_FixSlashes( sAbsolute, '/' ); |
| 761 | return std::string( FILE_URL_PREFIX ) + sAbsolute; |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | // ----------------------------------------------------------------------------------------------------- |
| 766 | // Purpose: Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned |
nothing calls this directly
no test coverage detected