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

Function Path_Exists

samples/shared/pathtools.cpp:477–499  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Purpose: returns true if the the path exists -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

475// Purpose: returns true if the the path exists
476//-----------------------------------------------------------------------------
477bool Path_Exists( const std::string & sPath )
478{
479 std::string sFixedPath = Path_FixSlashes( sPath );
480 if( sFixedPath.empty() )
481 return false;
482
483#if defined( WIN32 )
484 struct _stat buf;
485 std::wstring wsFixedPath = UTF8to16( sFixedPath.c_str() );
486 if ( _wstat( wsFixedPath.c_str(), &buf ) == -1 )
487 {
488 return false;
489 }
490#else
491 struct stat buf;
492 if ( stat ( sFixedPath.c_str(), &buf ) == -1)
493 {
494 return false;
495 }
496#endif
497
498 return true;
499}
500
501
502//-----------------------------------------------------------------------------

Calls 4

emptyMethod · 0.80
Path_FixSlashesFunction · 0.70
UTF8to16Function · 0.70
statClass · 0.70

Tested by

no test coverage detected