Unity’s console shows an Error message “error CS0117: System.IO.Directory' does not contain a definition for GetAccessControl’”.
It was referring to this line: System.IO.Directory.GetAccessControl(“foo”);
MonoDevelop’s “intellisense” reveals that GetAccessControl is a proper function of System.IO.Directory.
In fact, the MonoDevelop doesn’t show any errors, nor warnings, not issues at all.
Plus, even the documentation says that GetAccessControl is a method of System.IO.Directory.
This is the first time I’ve encountered something so strange. Any advice?
My first thought was that the function might not be available in the version of .NET that Unity uses, but both Xamarin and MSDN says that it’s been available since .NET 2.0.
Regardless, it is the sort of thing that might be awkward or nonsensical in a cross-platform context, so it might have been skipped over or purposely removed for Unity.
If it is just an accidental oversight in Unity’s version of the .NET runtime, you could try creating an instance of DirectoryInfo using your path string and then calling its own GetAccessControl() method (no parameters).
Now Unity console shows another error message:
error CS1061: Type System.IO.DirectoryInfo' does not contain a definition for GetAccessControl’ and no extension method GetAccessControl' of type System.IO.DirectoryInfo’ could be found (are you missing a using directive or an assembly reference?)
I’m using Unity 5.4 and Visual Sudio 2015 as my Editor.
Even using the Namespaces of
System.IO;
System.Security.AccessControl;
Visual Studio fails to find an GetAccessControl method in either Directory or DirectoryInfo, even though as @AndyGainey states the documentation on MSDN states its been in since 2.0.
This leads me to believe its stripped out of Unity’s .Net libraries for whatever reasons. I’m surprised Mono’s Intellisense shows it as a valid method when VS doesn’t
When using System.Directory.Exists, unexpected behaviour happened, so I posted a thread here.
I found another workaround for that unexpected behaviour, which is “Chibueze Opata”'s reply from this stack overflow discussion here.
In “Chibueze Opata”'s reply, the function “System.IO.Directory.GetAccessControl()” is called.
However, GetAccessControl() also produced unexpected problems.
Just in case anyone wants to know why I need to call GetAccessControl().
What platform are you targeting? Some platforms use a slightly different subset of .Net. File access is one thing that’s not consistent across all platforms.
I am targeting Android platform, no specific device in mind.
This is what I originally wanted, as described in this post here.
I was wondering if there is a built-in android “photograph picker”.
I want the user to be able to choose a photograph that he has taken using his camera.
However, I was unable to find a way to do so.
So, I decided to write my own custom photograph picker.
Through google-ing, I am unable to find a path that’s the standard across all Android phones, where photographs that are taken by the camera are agreed to be stored.
Thus, the only solution I can think of is to find every “.png”, “.jpg”, or “.jpeg” file on the phone, load it into a Sprite, then manually code out a custom photograph picker.
A big problem is that this solution would also grab images that are lying around somewhere in the storage, that I don’t want. Anyone have a solution to this?
Does android have any built-in android “photograph picker” that’s available?
Just in case anyone wants to know the problem on the higher level.