问题
UPDATE : I have found a solution for the iOS and Android versions, however, I'm still getting this error when building for Mac and Windows. I've seen a workaround that only gets me the name of the drives :
foreach (string drive in Directory.GetLogicalDrives());
... But that doesn't get me anywhere in terms of free space.
ORIGINAL QUESTION :
I am working in Unity C#.
I'd like to get the free available disk space on the device I'm using. I've tried using System.IO.DriveInfo
but it doesn't work as I receive:
NotImplementedException: The requested feature is not implemented.
...when I try to get the drives. I think this is only a Windows problem, but I haven't found a solution doing my research. I'm also wondering if this class will work on Android, iOS and Mac as well.
DriveInfo[] allDrives = DriveInfo.GetDrives();
Why is this not working? And is there a better solution that would work on all platforms?
来源:https://stackoverflow.com/questions/24144003/get-available-disk-space-in-unity