mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2025-12-06 04:04:53 +01:00
Implement GetFileDetails.
This commit is contained in:
parent
acebfc4e4d
commit
c8092f9f45
5 changed files with 391 additions and 29 deletions
33
dll/base.cpp
33
dll/base.cpp
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue