简体   繁体   English

获取可用于Mac上的应用程序的磁盘空间

[英]Get disk space available for application on Mac

I'm currently using Unity3D, and using C# as my main script language. 我目前正在使用Unity3D,并使用C#作为主要脚本语言。 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. 我的资产正在按Application.persistentDataPath给出的路径前进。

I need to check this for a Mac Standalone build ! 我需要为Mac Standalone版本检查一下!

Would anyone know how to check this, preferably in Unity C#, but I can work with native code and such if I have to ! 任何人都不会知道如何进行检查,最好是在Unity C#中进行检查,但是我可以使用本机代码,如果需要的话!

UPDATE : 更新:

Upon seeing the answer from @Marius George, I'm just wondering about a little detail : That methods gives me information on all drives. 看到@Marius George的回答后,我只是想知道一个细节:该方法为我提供了所有驱动器上的信息。 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: 我认为System.IO.DriveInfo类可在某些平台上运行:

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

See if this works on Mac. 看看这在Mac上是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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