问题
I have a C# Mono program (Unity3d game) that unzips a zip archive using SharpZLib. My problem is that when the archive is unzipped on Mac OSX, the file permissions are different. Specifically they are set to 644 while I want them to be 755. I don't know why the file permissions are not kept the same after unzipping, but in any case I need to set permissions for all extracted files to 755 after unzipping.
How can I do this with C#? I also need this to work on Windows and not only Mac OSX but at the worst case I can just have a special code path for Mac.
Note that I cannot use Mono.Posix to do this, because it is not available for my program as Unity3d does not include it in the build.
Thanks in advance.
回答1:
Nevermind, I did it using System.Diagnostics.Process. That's what I was trying before but I was passing the wrong arguments to chmod and thought that it wasn't working.
来源:https://stackoverflow.com/questions/18505353/how-run-chmod-in-osx-with-c-sharp