Re: Getting Free Disk Space
Posted: Tue May 27, 2014 5:02 pm
I had a variable that bothered elsewhere in my code, it works perfectly now
Thank you very much for your help: D
Thank you very much for your help: D
http://www.purebasic.com
https://www.purebasic.fr/english/
Thanks you for you fast answer, but I'm using the full version of PureBasic, not trial.RASHAD wrote:PureBasic demo version don't support Windows API calls
GetDiskFreeSpaceEx() is a Windows API function, and will not work on MacOS or Linux. This example includes MacOS API calls for similar functionalities:JoseT wrote:...when I call "GetDiskFreeSpaceEx_()" I get the error: "GetDiskFreeSpaceEx_() is not a function, array, list, map or macro".
Code: Select all
Define.q availableSize, totalSize, freeSize
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
GetDiskFreeSpaceEx_("C:", @availableSize, @totalSize, @freeSize)
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
fm = CocoaMessage(0, 0, "NSFileManager defaultManager")
fs = CocoaMessage(0, fm, "attributesOfFileSystemForPath:$", @"/", "error:", #nil)
sz = CocoaMessage(0, fs, "objectForKey:$", @"NSFileSystemSize")
fs = CocoaMessage(0, fs, "objectForKey:$", @"NSFileSystemFreeSize")
CocoaMessage(@freeSize, sz, "longLongValue")
CocoaMessage(@totalSize, fs, "longLongValue")
CompilerEndIf
Debug "Total: " + FormatNumber(totalSize, 0) + " bytes"
Debug "Free: " + FormatNumber(freeSize, 0) + " bytes"
Finally, this problem was solved with reinstallation of PB. I think you are right, my installation was corrupted, I supose.JoseT wrote:Thanks you for you fast answer, but I'm using the full version of PureBasic, not trial.RASHAD wrote:PureBasic demo version don't support Windows API calls