Implement GetFileDetails.

This commit is contained in:
Mr_Goldberg 2021-09-19 01:07:19 -04:00
parent acebfc4e4d
commit c8092f9f45
No known key found for this signature in database
GPG key ID: 8597D87419DEF278
5 changed files with 391 additions and 29 deletions

View file

@ -256,6 +256,39 @@ std::string canonical_path(std::string path)
return output;
}
bool file_exists_(std::string full_path)
{
#if defined(STEAM_WIN32)
struct _stat buffer;
if (_wstat(utf8_decode(full_path).c_str(), &buffer) != 0)
return false;
if ( buffer.st_mode & _S_IFDIR)
return false;
#else
struct stat buffer;
if (stat(full_path.c_str(), &buffer) != 0)
return false;
if (S_ISDIR(buffer.st_mode))
return false;
#endif
return true;
}
unsigned int file_size_(std::string full_path)
{
#if defined(STEAM_WIN32)
struct _stat buffer = {};
if (_wstat(utf8_decode(full_path).c_str(), &buffer) != 0) return 0;
#else
struct stat buffer = {};
if (stat (full_path.c_str(), &buffer) != 0) return 0;
#endif
return buffer.st_size;
}
static void steam_auth_ticket_callback(void *object, Common_Message *msg)
{
PRINT_DEBUG("steam_auth_ticket_callback\n");