| 33 | namespace FileSystemHelpers |
| 34 | { |
| 35 | static std::string GetFullPathString( char const* pPath ) |
| 36 | { |
| 37 | assert( pPath != nullptr && pPath[0] != 0 ); |
| 38 | |
| 39 | char fullpath[256] = { 0 }; |
| 40 | DWORD length = GetFullPathNameA( pPath, 256, fullpath, nullptr ); |
| 41 | assert( length != 0 && length != 255 ); |
| 42 | |
| 43 | // We always append the trailing slash to simplify further operations |
| 44 | DWORD const result = GetFileAttributesA( fullpath ); |
| 45 | if ( result != INVALID_FILE_ATTRIBUTES && ( result & FILE_ATTRIBUTE_DIRECTORY ) && fullpath[length - 1] != '\\' ) |
| 46 | { |
| 47 | fullpath[length] = '\\'; |
| 48 | fullpath[length + 1] = 0; |
| 49 | } |
| 50 | |
| 51 | return std::string( fullpath ); |
| 52 | } |
| 53 | |
| 54 | static std::string GetFullPathString( std::string const& path ) |
| 55 | { |
no outgoing calls
no test coverage detected