[Mono-list] Create a file with execute permission?

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Fri Sep 24 14:00:05 EDT 2010


On Thu, 2010-09-23 at 03:36 -0700, kevink wrote:
> I create a .sh file and try to execute it with Process.Start() in my app.
> This is failing as the file is created without the "Execute" permission. Is
> there a way to specify this in C# on mono?

Once you have created the file, you can set the "Execute" permission in
Mono with something like:

	File.SetAttributes (name, (FileAttributes)((int) File.GetAttributes
(name) | 0x8000000);

The 0x8000000 attribute will only work with Mono and is internal.

-Gonzalo




More information about the Mono-list mailing list