Hi
When I create a file using the OpenFile() function it appears that the file is created in Linux as readonly. I am using OpenSuse 43.2. So I am wondering how to fix this. If I use the SetFileAttributes() with #PB_FileSystem_ReadAll and
#PB_FileSystem_WriteAll will that set the attributes so that anyone can read and write to the file.
Thanks,
Simon
File Rights Question
File Rights Question
Simon White
dCipher Computing
dCipher Computing
-
- Enthusiast
- Posts: 271
- Joined: Thu Dec 17, 2009 12:00 pm
- Location: Llangadog, Wales, UK
- Contact:
Re: File Rights Question
Surprised you are getting read-only! Or do you mean it is read-only for ANY user?
From OpenFile I get - read-write:User, read-only:Group, read-only:Any
Which is what I would expect. Checked on MX Linux and Manjaro, but I'd guess others to be the same.
Yes, you can change permissions with SetFileAttributes() as documented. But beware as permissions will be exactly what you specify, replacing the original settings. So using #PB_FileSystem_ReadAll only will remove read:User.
To keep existing permissions and add more, you want something like:
From OpenFile I get - read-write:User, read-only:Group, read-only:Any
Which is what I would expect. Checked on MX Linux and Manjaro, but I'd guess others to be the same.
Yes, you can change permissions with SetFileAttributes() as documented. But beware as permissions will be exactly what you specify, replacing the original settings. So using #PB_FileSystem_ReadAll only will remove read:User.
To keep existing permissions and add more, you want something like:
Code: Select all
myFileAttributes = GetFileAttributes("/home/userme/Test.txt")
SetFileAttributes("/home/userme/Test.txt", myFileAttributes | #PB_FileSystem_ReadAll | #PB_FileSystem_WriteAll)
Re: File Rights Question
Thanks for showing how the attributes should be set. The problem with readonly may have to do with some customization of my current Linux setup but knowing how to set the file attributes will enable me to handle the issue.
Thanks,
Simon
Thanks,
Simon
Simon White
dCipher Computing
dCipher Computing