Permission & SpecialFolder

Hi,
I need to know how to use permissions command.

I want to do chmod to a shell file in linux into 777.
there is no example found on the xojo example project folder.

and I am also tried to create a file in linux home folder using specialfolder.home with no luck.

dim f as new folderitem
dim TextOut as textoutputstream
f=SpecialFolder.Home.Child("wa.sh")
if f.Exists then
f.Delete
TextOut = f.CreateTextFile
TextOut.Writeline s
TextOut.Close
end if

any help ?

thanks
Arief

f.Permissions = &o777

https://documentation.xojo.com/api/files/folderitem.html.Permissions

2 Likes

You’re only creating the file if it already exists. If the file doesn’t exist, the code in your IF condition won’t execute and you’ll never create the file. Try

dim f as new folderitem
dim TextOut as textoutputstream
f=SpecialFolder.Home.Child("wa.sh")
if f.Exists then f.Delete
TextOut = f.CreateTextFile
TextOut.Writeline s
TextOut.Close

yes, I missed that one.

thanks for the help

Regards,
Arief