About

The BrowseVolumes class provides means to iterate through the volumes/drives mounted in the system.

Using the BrowseVolumes class always follows the same concept:

  • Allocate a BrowseVolumes instance.
  • Initalizes the BrowseVolumes instance via Init().
  • Call GetNext() at least once (but most likely in a loop) to get the first/next element (if any).
  • Use the below mentioned volume info functions on each element.
// This example demonstrates browsing volumes with BrowseVolumes.
AutoAlloc<BrowseVolumes> browseVolumes;
if (!browseVolumes)
return false;
browseVolumes->Init();
GePrint("Available volumes:");
while (browseVolumes->GetNext()) // Note: GetNext() needs to be called at least once, to get the first element.
{
const Filename fn = browseVolumes->GetFilename();
Int32 bvFlags = 0;
const String volumeName = browseVolumes->GetVolumeName(&bvFlags);
{
UInt64 freecaller = 0, total = 0, freespace = 0;
String freeText = "";
if (GeFGetDiskFreeSpace(fn, freecaller, total, freespace))
freeText = ": " + String::MemoryToString(freespace) + " of " + String::MemoryToString(total) + " free, (" + String::MemoryToString(freecaller) + " available for C4D)";
GePrint(" " + fn.GetString() + " (" + volumeName + ")" + freeText);
}
}

Allocation/Deallocation

BrowseVolumes objects are created with the usual tools, see Entity Creation and Destruction Manual.

Use

Browsing

Volume Info

Further Reading