Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer > Re: Get login n...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 24 of 49 Topic 942 of 1040
Post > Topic >>

Re: Get login name and/or path to home directory of current user?

by Gregory Weston <uce@[EMAIL PROTECTED] > Jun 1, 2007 at 10:28 AM

In article <13605c02atob716@[EMAIL PROTECTED]
>,
 SM Ryan <wyrmwif@[EMAIL PROTECTED]
> wrote:

> Gregory Weston <uce@[EMAIL PROTECTED]
> wrote:
> # In article <465fb6ab$0$14071$742ec2ed@[EMAIL PROTECTED]
>,
> #  Don Bruder <dakidd@[EMAIL PROTECTED]
> wrote:
> # 
> # > Oh, to bring things back on-topic, Bo's suggestion (the
FSFindFolder() 
> # > function) is working perfectly - toss the resulting FSRef for the
user's 
> # > homedir to FSRefMakePath() to get ThePath in a form I can tinker
with, 
> # > strcat(&ThePath, "/Client.log") to tack the filename onto it, run 
> # > ThePath back into FSPathMakeRef(), and I've got exactly what I need,

> # > working exactly as wanted. Minimal heartburn, maximal function -
Gotta 
> # > love it :) 
> # 
> # If all you're doing is trying to build a reference to a file within a 
> # known directory, you can do it in one shot with this instead of 
> # converting to path, appending the leaf name, and converting back to
ref.
> # 
> # OSErr FSMakeFSRefUnicode (
> #    const FSRef * parentRef,
> #    UniCharCount nameLength,
> #    const UniChar * name,
> #    TextEncoding textEncodingHint,
> #    FSRef * newRef
> # );
> # 
> # 
> # Only 1 line to debug and only one error code to check.
> 
> I can see how that's easier
> 
> I instead do complicated things like
> 	asprintf(&childpath,"%s/%s",parentpath,childcomponent)
> which unfortunately lets me refer to nonexistent directories
> which I can mkdir at my leisure, or do any kind string editting
> on because its only checked if it's a valid path when I try to
> use it as a path. And we all know nobody would do something like
> globbing for file names.

Did you catch the part in the post to which you responded a minute 
earlier where I used the phrase "the right tool for the job?"

Did you notice that the OP is trying to create a reference to a single 
file that already exists? (And, in fact, the error result this function 
would give him if the file _doesn't_ exists, obviates some additional 
code.)

You can answer all the unasked questions you like your own code, but 
sarcastic reactions to people answering the actual questions don't help 
anyone, including you.

G
 




 49 Posts in Topic:
Get login name and/or path to home directory of current user?
Don Bruder <dakidd@[EM  2007-05-29 23:56:30 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-05-30 07:33:28 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-05-30 12:39:12 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 08:26:55 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 07:15:29 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 12:47:58 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 10:18:03 
Re: Get login name and/or path to home directory of current user
glenn andreas <gandrea  2007-06-01 11:00:38 
Re: Get login name and/or path to home directory of current user
russotto@[EMAIL PROTECTED  2007-06-03 20:38:20 
Re: Get login name and/or path to home directory of current user
glenn andreas <gandrea  2007-06-04 08:53:09 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 18:43:50 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 20:47:41 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-06-01 19:05:34 
Re: Get login name and/or path to home directory of current user
Sean McBride <cwatson@  2007-06-02 13:26:49 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-04 14:08:38 
Re: Get login name and/or path to home directory of current user
Bo Lindbergh <blgl@[EM  2007-05-30 11:27:08 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-05-30 12:41:44 
Re: Get login name and/or path to home directory of current user
David Phillip Oster <o  2007-05-31 02:51:48 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-05-30 20:59:08 
Re: Get login name and/or path to home directory of current user
Jens Ayton <IWISNEXPQQ  2007-05-31 21:29:13 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-05-31 23:03:31 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 07:20:53 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 12:48:00 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 10:28:13 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 18:43:51 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 20:34:55 
Re: Get login name and/or path to home directory of current user
Don Bruder <dakidd@[EM  2007-06-01 06:07:37 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-01 10:46:07 
Re: Get login name and/or path to home directory of current user
Michael Ash <mike@[EMA  2007-06-01 10:19:22 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 18:33:34 
Re: Get login name and/or path to home directory of current user
glenn andreas <gandrea  2007-06-01 16:14:02 
Re: Get login name and/or path to home directory of current user
Michael Ash <mike@[EMA  2007-06-01 16:54:16 
Re: Get login name and/or path to home directory of current user
Bo Lindbergh <blgl@[EM  2007-06-02 13:14:06 
Re: Get login name and/or path to home directory of current user
Michael Ash <mike@[EMA  2007-06-02 07:10:43 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 18:33:46 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 18:33:59 
Re: Get login name and/or path to home directory of current user
russotto@[EMAIL PROTECTED  2007-06-03 20:35:12 
Re: Get login name and/or path to home directory of current user
Gabriele Greco <gabrie  2007-06-11 15:59:22 
Re: Get login name and/or path to home directory of current user
Ben Artin <macdev@[EMA  2007-06-11 08:13:57 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-11 23:02:08 
Re: Get login name and/or path to home directory of current user
Steven Fisher <steve@[  2007-06-12 00:42:44 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-11 20:53:38 
Re: Get login name and/or path to home directory of current user
Ben Artin <macdev@[EMA  2007-06-11 17:58:24 
Re: Get login name and/or path to home directory of current user
Gregory Weston <uce@[E  2007-06-11 17:47:12 
Re: Get login name and/or path to home directory of current user
Michael Ash <mike@[EMA  2007-06-11 19:36:11 
Re: Get login name and/or path to home directory of current user
Steven Fisher <steve@[  2007-06-12 00:41:25 
Re: Get login name and/or path to home directory of current user
SM Ryan <wyrmwif@[EMAI  2007-06-01 07:52:08 
Re: Get login name and/or path to home directory of current user
Sherm Pendley <spamtra  2007-06-01 02:26:44 
Re: Get login name and/or path to home directory of current user
Clark Cox <clarkcox3@[  2007-05-31 16:24:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 7:02:02 CST 2008.