Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / April 2007



Tip: Looking for answers? Try searching our database.

Resolving '~' (tilde) path?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
slashlos - 21 Apr 2007 21:43 GMT
Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
key to use the unix getpwnam() routine, isn't there an object method
that can return this more directly?
Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

Jens Ayton - 21 Apr 2007 21:53 GMT
slashlos:

> Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
> key to use the unix getpwnam() routine, isn't there an object method
> that can return this more directly?

-[NSString stringByExpandingTildeInPath];

Signature

Jens Ayton

Patrick Machielse - 21 Apr 2007 23:45 GMT
> slashlos:
> >
[quoted text clipped - 3 lines]
>
> -[NSString stringByExpandingTildeInPath];

or:

NSHomeDirectory();

patrick
slashlos - 22 Apr 2007 14:00 GMT
>> slashlos:
>>> Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
[quoted text clipped - 7 lines]
>
> patrick

sounds good but I don't see that package listed in the class browser?

Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

Patrick Machielse - 22 Apr 2007 15:51 GMT
> > NSHomeDirectory();
>
> sounds good but I don't see that package listed in the class browser?

It's a function. The NS prefix can be applied to:

- classes (NSObject)
- functions (NSMakeRect())
- storage types (NSRect)
- ...

<http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Mis
cellaneous/Foundation_Functions/Reference/reference.html>

patrick
slashlos - 22 Apr 2007 14:39 GMT
>> slashlos:
>>> Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
[quoted text clipped - 7 lines]
>
> patrick
thanks; is there a cheat list of routines like this?

Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

Simon Slavin - 25 Apr 2007 20:48 GMT
On 22/04/2007, slashlos wrote in message <sAJWh.15$RX2.2@newsfe12.lga>:

> thanks; is there a cheat list of routines like this?

It's part of the Cocoa documentation.  You have to get a handle on how
Cocoa classes relate to one-another, then you'll have a good guess about
which class to read the documentation for when you're looking for
something.

Simon.
Signature

http://www.hearsay.demon.co.uk

slashlos - 22 Apr 2007 14:02 GMT
> slashlos:
>> Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
>> key to use the unix getpwnam() routine, isn't there an object method
>> that can return this more directly?
>
> -[NSString stringByExpandingTildeInPath];

thanks, knew there had to be a better way but never would'a guessed it'd
be there.

Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

slashlos - 22 Apr 2007 14:38 GMT
> slashlos:
>> Other than using NSProcessInfo and using 'HOME' env key, or the 'USER'
>> key to use the unix getpwnam() routine, isn't there an object method
>> that can return this more directly?
>
> -[NSString stringByExpandingTildeInPath];

This method doesn't seems to resolve; what do I need to import?

Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

Jens Ayton - 22 Apr 2007 14:47 GMT
slashlos:
> Jens Ayton:
>> slashlos:
[quoted text clipped - 6 lines]
>
> This method doesn't seems to resolve; what do I need to import?

Eh? It's in Foundation, declared in NSPathUtilities.h.

[elsewhere in thread:]

> thanks; is there a cheat list of routines like this?

Help menu -> Documentation.

Signature

Jens Ayton

slashlos - 22 Apr 2007 17:50 GMT
> slashlos:
>> Jens Ayton:
[quoted text clipped - 12 lines]
>
> Help menu -> Documentation.

thanks to all; yes I'd been scouring around and saw that header but it
didn't dawn on me to just use this (duh):

    [@"~" stringByExpandingTildeInPath]

my function search in help wasn't set to 'API search' and searching
'NSHomeDirectory' doesn't get a hit with 'Full-Text search so I was puzzled.

This to me is my biggest [only?] sense of frustration is knowing what I
want to do but unable to find it unless I know where and how to query.

It's a tricky thing but I guess I'll get better (?) with experience;-)
Signature

 /los "I was a teenage net-random"
------------------------------------------------------------------------
Opinions expressed here are mine and not necessarily those of my employer!
------------------------------------------------------------------------

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.