Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool directory_exists( const string &directory )
- {
- #if _WIN32
- wstring directoryW( convert_to_utf16(directory) );
- struct _stat64 status;
- if( _wstat64(directoryW.c_str(), &status) == 0 )
- #else // _WIN32
- struct stat status;
- if( stat(directory.c_str(), &status) == 0 )
- #endif //_WIN32
- {
- if ( status.st_mode & S_IFDIR )
- return true;
- }
- return false;
- }
- bool file_exists( const string &filename )
- {
- #if _WIN32
- wstring filenameW( convert_to_utf16(filename) );
- struct _stat64 status;
- if( _wstat64(filenameW.c_str(), &status) == 0 )
- #else // _WIN32
- struct stat status;
- if( stat(filename.c_str(), &status) == 0 )
- #endif //_WIN32
- {
- if ( status.st_mode & S_IFREG )
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement