Checking my permissions I see that I, the
current user, for the folder that the copied Xcode application is in, is
drwx------, while the copied folders have permissions set at, drwxr-xr-x.
So would my current permissions have to
match the copied folders permissions? I would think that the copied folders had
higher permission so the fopen would work anyway.
Going on to answer everyone else who is
helping.
The return ‘errno’ from fopen is ENOENT. But
as I said this was working before I signed on as a new user. The fopen used a
string, i.e., “otr/mynewfolder/myfile.db” and would create the directory tree
along with the empty file ‘myfile.db’. As stated in ‘man fopen’ “.. The file is
created if it does not exist, …”
On the same line, I see that in my ‘Target’
information in Xcode for this project, under Target, GetInfo/Build, there is a
preset ‘Install Permissions’ set to a-w,a+rX, could changing or adding to this
help me advoid this fopen problem in the future? Also there is an ‘Install
Group’ = $(GROUP) and ‘Install Owner’ $(USER) set. Like I said I want to make
sure that when I send this app out for distribution it will install on all
machine no matter who the current logged in user is.
As always I really appreciate everyone’s
input and help
Carl
Chris Espinosa
Sent: Thursday, June 30, 2005 1:58 PM
To: XCode Users
Subject: Re: fopen
On Jun 30, 2005, at 10:38 AM, Carl Smith wrote:
I have
been running some code, via my xcode project for some time now. The other day I
had problems with my user account, another story, so I created a new admin user
account. I put my xcode project into my new users/me folder and opened the
xcode from the new location.
My
problem is I have an FILE *fp = fopen(m_szfilepathandname, “wb”) line that was
working before. Now it fails, fp = NULL, and the folder is not created, on my
hard drive, as it was before. It is like I do not have permissions to create
this folder, but before I did.
Is
there some way to force fopen to work, because I need to work on what every
machine I install this app on. Maybe there is another way I should be creating
this new folder/path?
Check the permissions on the parent folder. If
you just drag-copied it from one user account to another, the enclosing folder
is probably still owned by your previous user account, and may not afford
privileges to the new user account to create files in it.