-localizedName is interesting... If we get around to making a desktop, it sounds like in the long term, -localizedName should not source its information from sources such as NSS or /etc/hostname; rather it should be a user-friendly string that is configurable somewhere in SystemPreferences and include things such as spaces.
And for non-local hosts, it should probably interact with zeroconf services to figure out the correct name. But those are just notes for the long term. On Fri, Apr 18, 2014 at 10:06 PM, Richard Frith-Macdonald <r...@gnu.org>wrote: > > On 18 Apr 2014, at 15:37, Riccardo Mottola <riccardo.mott...@libero.it> > wrote: > > > Hi, > > > > Given this situation: > > > > # hostname > > hobbit > > > > # hostname -a > > localhost > > > > > > I'd expect [[NSHost currentHost] name] to return the name, not the alias. > > If you look at the documentation (either the GNUstep documentation or the > Apple documentation) you will see that your expectation is misguided ... > the -name method returns *a* name of the host, not necessarily any > particular one. > > If you have code which prefers particular names, you should use the -names > method to get all the names for the host, and then use some heuristic to > pick the one you prefer to use. > > Eg, you might want a name without the domain component (so you'd exclude > names containing dots) and you might want to exclude localhost, and then > perhaps you might want to pick the first shortest remaining name in > alphabetical order. > > All that being said ... I suspect the behavior you are looking for is that > of the -localizedName method Apple added in OSX 10.6 > I've just hacked in a quick implementation (untested) in svn trunk that > you could try. > _______________________________________________ > Discuss-gnustep mailing list > Discuss-gnustep@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnustep > -- Ivan Vučica i...@vucica.net
_______________________________________________ Discuss-gnustep mailing list Discuss-gnustep@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnustep