It is currently Mon Sep 24, 2018 1:00 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: File Rights Question
PostPosted: Thu Dec 14, 2017 1:45 am 
Offline
Enthusiast
Enthusiast

Joined: Thu May 21, 2009 6:56 pm
Posts: 476
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


Top
 Profile  
Reply with quote  
 Post subject: Re: File Rights Question
PostPosted: Fri Dec 15, 2017 1:48 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Dec 17, 2009 12:00 pm
Posts: 159
Location: Llangadog, Wales, UK
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:
Code:
myFileAttributes = GetFileAttributes("/home/userme/Test.txt")   
SetFileAttributes("/home/userme/Test.txt", myFileAttributes | #PB_FileSystem_ReadAll | #PB_FileSystem_WriteAll)

_________________
www.deeproot.co.uk


Top
 Profile  
Reply with quote  
 Post subject: Re: File Rights Question
PostPosted: Mon Dec 18, 2017 3:28 pm 
Offline
Enthusiast
Enthusiast

Joined: Thu May 21, 2009 6:56 pm
Posts: 476
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye