diff options
author | John Emmas <johne53@tiscali.co.uk> | 2013-08-04 17:01:37 +0100 |
---|---|---|
committer | John Emmas <johne53@tiscali.co.uk> | 2013-08-04 17:01:37 +0100 |
commit | d176cbc80476cdc8ca082631efc171ea39116d63 (patch) | |
tree | 16645ddb055c746ab92b8b1d2639ba8fcf5c433b /libs/ardour/session_state.cc | |
parent | 490311bc081b12d328e6e02cac8170538e96fb2f (diff) |
'libs/ardour' - Compiler specific includes and includes
Diffstat (limited to 'libs/ardour/session_state.cc')
-rw-r--r-- | libs/ardour/session_state.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 62edaa3911..80f1e87972 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2114,6 +2114,54 @@ Session::refresh_disk_space () _total_free_4k_blocks_uncertain = true; } } +#elif defined (COMPILER_MSVC) + vector<string> scanned_volumes; + vector<string>::iterator j; + vector<space_and_path>::iterator i; + DWORD nSectorsPerCluster, nBytesPerSector, + nFreeClusters, nTotalClusters; + char disk_drive[4]; + bool volume_found; + + _total_free_4k_blocks = 0; + + for (i = session_dirs.begin(); i != session_dirs.end(); i++) { + strncpy (disk_drive, (*i).path.c_str(), 3); + disk_drive[3] = 0; + strupr(disk_drive); + + volume_found = false; + if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters))) + { + int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster; + int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters; + i->blocks = (uint32_t)(nFreeBytes / 4096); + + for (j = scanned_volumes.begin(); j != scanned_volumes.end(); j++) { + if (0 == j->compare(disk_drive)) { + volume_found = true; + break; + } + } + + if (!volume_found) { + scanned_volumes.push_back(disk_drive); + _total_free_4k_blocks += i->blocks; + } + } + } + + if (0 == _total_free_4k_blocks) { + strncpy (disk_drive, path().c_str(), 3); + disk_drive[3] = 0; + + if (0 != (GetDiskFreeSpace(disk_drive, &nSectorsPerCluster, &nBytesPerSector, &nFreeClusters, &nTotalClusters))) + { + int64_t nBytesPerCluster = nBytesPerSector * nSectorsPerCluster; + int64_t nFreeBytes = nBytesPerCluster * (int64_t)nFreeClusters; + _total_free_4k_blocks = (uint32_t)(nFreeBytes / 4096); + } + } #endif } |