Re: Getting the User/Owner of another process
Re: Getting the User/Owner of another process
- Subject: Re: Getting the User/Owner of another process
- From: "M. Uli Kusterer" <email@hidden>
- Date: Tue, 30 Sep 2003 19:46:15 +0200
At 9:41 Uhr -0700 30.09.2003, John Farmer wrote:
When the Startup Item calls NSUserName() (which according to the
documentation and I quote: "Returns the logon name of the current user."),
returns root (the owner of the process), not the logon name of the current
user. When I run NSHomeDirectory it gives me the roots home directory, this
doesn't help me because I need the current User Name to get the path for the
preferences.
There *is no* current user at StartupItems time, apart from root. If
you want to do startup per-user, you have to register a Login Item,
that is launched when a particular user logs in. So, I doubt you'll
find a copy of Finder running at that time, either.
/Users/johnfarmer/Library/Preferences/... I need to get the user name for
John Farmer so I can create the path to access the user's plist. I can
however get the user name from the Preference Pane, but I can't have the
user opening the Preference Pane everytime they login just to startup the
network.
Register a Login Item instead, which sends the location of the
current user's prefs to your driver. There is a piece of sample code
available from Apple (look on their web site, or e-mail DTS if it
isn't there) called the LoginItemsAPI, which lets you add and remove
login items.
--
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.