Esempio n. 1
0
SString SharedUtil::GetDriveNameWithNotEnoughSpace( uint uiResourcesPathMinMB, uint uiDataPathMinMB )
{
    if ( GetPathFreeSpaceMB( GetMTASABaseDir() ) < uiResourcesPathMinMB )
        return GetPathDriveName( GetMTASABaseDir() );
    if ( GetPathFreeSpaceMB( GetSystemCommonAppDataPath() ) < uiDataPathMinMB )
        return GetPathDriveName( GetSystemCommonAppDataPath() );
   return ""; 
}
Esempio n. 2
0
SString SharedUtil::GetDriveNameWithNotEnoughSpace(uint uiResourcesPathMinMB, uint uiDataPathMinMB)
{
    SString strFileCachePath = GetCommonRegistryValue("", "File Cache Path");
    if (!strFileCachePath.empty() && DirectoryExists(PathJoin(strFileCachePath, "resources")))
        if (GetPathFreeSpaceMB(strFileCachePath) < uiResourcesPathMinMB)
            return GetPathDriveName(strFileCachePath);

    if (GetPathFreeSpaceMB(GetMTASABaseDir()) < uiResourcesPathMinMB)
        return GetPathDriveName(GetMTASABaseDir());

    if (GetPathFreeSpaceMB(GetSystemCommonAppDataPath()) < uiDataPathMinMB)
        return GetPathDriveName(GetSystemCommonAppDataPath());
    return "";
}
Esempio n. 3
0
// Get drive free bytes available to the current user
uint SharedUtil::GetPathFreeSpaceMB( const SString& strPath )
{
    SString strDrive = GetPathDriveName( strPath );
    if ( !strDrive.empty() )
    {
        ULARGE_INTEGER llUserFreeBytesAvailable;
        if ( GetDiskFreeSpaceExW( FromUTF8( strDrive ), &llUserFreeBytesAvailable, NULL, NULL ) )
        {
            llUserFreeBytesAvailable.QuadPart /= 1048576UL;
            if ( llUserFreeBytesAvailable.HighPart == 0 )
                return llUserFreeBytesAvailable.LowPart;
        }
    }
    return -1;
}