mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
make CheckDiskSpace portable
This commit is contained in:
parent
ae3ae3df76
commit
8938414f0c
14
main.cpp
14
main.cpp
@ -1398,21 +1398,15 @@ string GetAppDir()
|
|||||||
|
|
||||||
bool CheckDiskSpace(int64 nAdditionalBytes)
|
bool CheckDiskSpace(int64 nAdditionalBytes)
|
||||||
{
|
{
|
||||||
uint64 nFreeBytesAvailable = 0; // bytes available to caller
|
wxLongLong nFreeBytesAvailable = 0;
|
||||||
uint64 nTotalNumberOfBytes = 0; // bytes on disk
|
if (!wxGetDiskSpace(GetDataDir(), NULL, &nFreeBytesAvailable))
|
||||||
uint64 nTotalNumberOfFreeBytes = 0; // free bytes on disk
|
|
||||||
|
|
||||||
if (!GetDiskFreeSpaceEx(GetAppDir().c_str(),
|
|
||||||
(PULARGE_INTEGER)&nFreeBytesAvailable,
|
|
||||||
(PULARGE_INTEGER)&nTotalNumberOfBytes,
|
|
||||||
(PULARGE_INTEGER)&nTotalNumberOfFreeBytes))
|
|
||||||
{
|
{
|
||||||
printf("ERROR: GetDiskFreeSpaceEx() failed\n");
|
printf("ERROR: wxGetDiskSpace() failed\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for 15MB because database could create another 10MB log file at any time
|
// Check for 15MB because database could create another 10MB log file at any time
|
||||||
if ((int64)nFreeBytesAvailable < 15000000 + nAdditionalBytes)
|
if (nFreeBytesAvailable < (int64)15000000 + nAdditionalBytes)
|
||||||
{
|
{
|
||||||
fShutdown = true;
|
fShutdown = true;
|
||||||
wxMessageBox("Warning: Your disk space is low ", "Bitcoin", wxICON_EXCLAMATION);
|
wxMessageBox("Warning: Your disk space is low ", "Bitcoin", wxICON_EXCLAMATION);
|
||||||
|
Loading…
Reference in New Issue
Block a user