How run chmod in OSX with C#

戏子无情 提交于 2019-12-10 21:13:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!