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

Function Path_IsAbsolute

samples/shared/pathtools.cpp:166–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164}
165
166bool Path_IsAbsolute( const std::string & sPath )
167{
168 if( sPath.empty() )
169 return false;
170
171#if defined( WIN32 )
172 if ( sPath.size() < 3 ) // must be c:\x or \\x at least
173 return false;
174
175 if ( sPath[1] == ':' ) // drive letter plus slash, but must test both slash cases
176 {
177 if ( sPath[2] == '\\' || sPath[2] == '/' )
178 return true;
179 }
180 else if ( sPath[0] == '\\' && sPath[1] == '\\' ) // UNC path
181 return true;
182#else
183 if( sPath[0] == '\\' || sPath[0] == '/' ) // any leading slash
184 return true;
185#endif
186
187 return false;
188}
189
190
191/** Makes an absolute path from a relative path and a base path */

Callers 1

Path_MakeAbsoluteFunction · 0.70

Calls 2

emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected