- Home /
Access to path /???? is denied on Mac OS
I download a file and placed it into a directory that I created with code on a Mac but it keeps giving me "Access is denied" error message whenever I try and move or copy that file to a different directory using Directory.Move(). I'm using Application.persistantDataPath, which work great on Windows, but not on a Mac. It also gives me the same problem when I create a iOS build. I have searched the net to find a solution, but non of the answers seems to work for me. I cant be only one with this problem.
Answer by enmeii · Jul 15, 2013 at 09:52 AM
bundlePathStr += "Sounds" + Path.DirectorySeparatorChar;
I think enmeii is implying that you may be using something like "Sounds\\tweet" on a PC, with the backwards PC pathname slash. And that using Path.DirSepChar
ins$$anonymous$$d will correct it to a backslash for a $$anonymous$$ac.
you are right, I should start using that, specially when I'm coding for cross platform...thanks
Answer by Graham-Dunnett · Jul 15, 2013 at 03:18 PM
Directory.Move(Application.persistentDataPath + "/old", Application.persistentDataPath + "/new");
That worked for me on a Mac. Note that on Mac the app runs in a sandboxed environment. You should not expect to have access to the hard drive of the machine. See:
Thanks for getting back to me, I'll take some time and go through the Sandbox Design Guide. I though it might have something to do with it, but I was hoping not...
I went through most of the Sandbox Design Guide and I realise that I might have to add Entitlements, but have no idea of how to do that in C#, let alone Unity. Surely I must be able to at least run the app within the Unity Editor and write to different directories that I create.