----------------------------------------------------------------------------- Purpose: returns true if the the path exists -----------------------------------------------------------------------------
| 475 | // Purpose: returns true if the the path exists |
| 476 | //----------------------------------------------------------------------------- |
| 477 | bool 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 | //----------------------------------------------------------------------------- |
no test coverage detected