[SOLVED] Re: Cocoa/Foundation and CoreFoundation
[SOLVED] Re: Cocoa/Foundation and CoreFoundation
- Subject: [SOLVED] Re: Cocoa/Foundation and CoreFoundation
- From: Matt Jaffa <email@hidden>
- Date: Sun, 14 Mar 2004 08:30:57 -0700
Using this tells you the current logged in Console user:
CFStringRef consoleUserName;
uid_t uid;
gid_t gid;
consoleUserName = SCDynamicStoreCopyConsoleUser(NULL, &uid, &gid);
NSString *hjjh = NSHomeDirectoryForUser((NSString*)consoleUserName);
Matt
On Mar 14, 2004, at 4:27 AM, M. Uli Kusterer wrote:
>
At 0:13 Uhr -0700 14.03.2004, Matt Jaffa wrote:
>
> When I call NSHomeDirectory() in my app it returns /var/root
>
> That is when i run the program as root,
>
> When I call NSHomeDirectory() and it is running as the user, it
>
> returns that users home directory,
>
>
>
> Now I need to find a way to modifiy the code to return the Users home
>
> directory of the current logged in user.
>
>
When an application is running as root, the current user *is* root.
>
Since, at any time your computer is running, there are numerous users
>
logged in "behind the scenes" (running daemons, the web server etc.)
>
at all times. There really is no way to find the "current user". The
>
best you can probably do is to create an application that the user has
>
to launch (or add to her login items) and have that application
>
occasionally poll your daemon and tell it where to send stuff. But
>
this isn't quite as easy, as communication between privileged and less
>
privileged users is involved (as far as I have heard -- never had to
>
do it).
>
>
I think you may want to read a good book on Unix and how the typical
>
Unix and its user management work.
>
--
>
Cheers,
>
M. Uli Kusterer
>
------------------------------------------------------------
>
"The Witnesses of TeachText are everywhere..."
>
http://www.zathras.de
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.