简体   繁体   中英

Get disk space available for application on Mac

I'm currently using Unity3D, and using C# as my main script language. My application downloads some assets from a server, and I need to make sure there is enough space available for this. My assets are going in the path that is given by Application.persistentDataPath.

I need to check this for a Mac Standalone build !

Would anyone know how to check this, preferably in Unity C#, but I can work with native code and such if I have to !

UPDATE :

Upon seeing the answer from @Marius George, I'm just wondering about a little detail : That methods gives me information on all drives. What I need is information for my app only, and not necessarily all the drives (my application might not have access to all of the disk space). Any ideas how to get the one drive I actually need?

I think the System.IO.DriveInfo class works on some platforms:

http://forum.unity3d.com/threads/disk-space-available.119725/

See if this works on Mac.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM