From 341a61607884bca75dfbffb4f49e64fee35bebc7 Mon Sep 17 00:00:00 2001 From: CaS Date: Mon, 23 Apr 2001 09:56:33 +0000 Subject: [PATCH] Bugfix for expanding tilde. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9668 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 2 ++ Source/NSString.m | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c5f4c05dd..4814f2d55 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ * Source/NSObject.m: ([+initialize]) call GSSetLocaleC() after other initialisation, to try to ensure that locale stuff is set up early before any attempt is made to use locale dependent code. + * Source/NSString.m: ([-stringByExpandingTildeInPath:]) fix suggested + by David Wetzel. 2001-04-22 Nicola Pero diff --git a/Source/NSString.m b/Source/NSString.m index 7c2c3c1db..562c264a0 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -2551,14 +2551,19 @@ handle_printf_atsign (FILE *stream, if (first_slash_range.location != 1) { /* It is of the form `~username/blah/...' */ - int uname_len; - NSString *uname; + int uname_len; + NSString *uname; if (first_slash_range.length != 0) - uname_len = first_slash_range.length - 1; + { + uname_len = first_slash_range.length - 1; + } else - /* It is actually of the form `~username' */ - uname_len = [self length] - 1; + { + /* It is actually of the form `~username' */ + uname_len = [self length] - 1; + first_slash_range.location = [self length]; + } uname = [self substringWithRange: ((NSRange){1, uname_len})]; homedir = NSHomeDirectoryForUser (uname); }