15 #include <sys/mount.h>
19 #if defined(AJA_WINDOWS)
23 #if defined(AJA_LINUX)
42 const double b_size = 1;
43 const double kb_size = 1000;
44 const double mb_size = 1000000;
45 const double gb_size = 1000000000;
47 const double b_size = 1;
48 const double kb_size = 1024;
49 const double mb_size = 1048576;
50 const double gb_size = 1073741824;
64 #if defined(AJA_WINDOWS)
65 static AJALock changingCurrentDirLock;
66 ULARGE_INTEGER free,total;
75 dwRet = GetCurrentDirectoryA(
MAX_PATH,origDir);
78 bool bSetResult = SetCurrentDirectoryA(dirPath);
81 bool bGetSpaceResult = ::GetDiskFreeSpaceExA( 0 , &free , &total ,
NULL );
86 bool bRet = SetCurrentDirectoryA(origDir);
89 if ( !bGetSpaceResult )
95 freeSpace =
static_cast<double>(
static_cast<__int64
>(free.QuadPart) ) / unitConv;
96 totalSpace =
static_cast<double>(
static_cast<__int64
>(total.QuadPart) ) / unitConv;
98 #elif defined(AJABareMetal)
105 if ( ::stat(dirPath,&stst) == -1 )
return false;
106 if ( ::statfs(dirPath,&stfs) == -1 )
return false;
108 freeSpace = stfs.f_bavail * ( stst.st_blksize / unitConv );
109 totalSpace = stfs.f_blocks * ( stst.st_blksize / unitConv );