Fix bug handling absolute path config.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36369 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2013-03-16 15:34:59 +00:00
parent 94bc79bf84
commit 505d8667f0
3 changed files with 14 additions and 7 deletions

View file

@ -2,6 +2,9 @@
* base/Source/NSCalendar.m:
Add simple quarter calculation.
* base/Source/NSPathUtilities.m:
Fix bug handling defaults dir config (was treating absolute path
as relative).
2012-03-16 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -856,9 +856,10 @@ MyApp.app/MyApp
</p>
<p>
The defaults database for a user is stored in the
subdirectory of the users home directory given by
GNUSTEP_USER_DEFAULTS_DIR (by default, the
<code>GNUstep/Defaults</code> subdirectory).
location given by GNUSTEP_USER_DEFAULTS_DIR in the
config file. This is usually a relative path (default, the
<code>GNUstep/Defaults</code> subdirectory) taken to specify
a subdirectory of the user's home directory.<br />
On mswindows this may be set to be ':REGISTRY:' to have defaults
stored in the windows registry rather than in the standard file
format.<br />

View file

@ -1851,7 +1851,6 @@ NSFullUserName(void)
NSString *
GSDefaultsRootForUser(NSString *userName)
{
NSString *home;
NSString *defaultsDir;
InitialisePathUtilities();
@ -1859,7 +1858,6 @@ GSDefaultsRootForUser(NSString *userName)
{
userName = NSUserName();
}
home = NSHomeDirectoryForUser(userName);
if ([userName isEqual: NSUserName()])
{
defaultsDir = gnustepUserDefaultsDir;
@ -1882,9 +1880,14 @@ GSDefaultsRootForUser(NSString *userName)
return defaultsDir; // Just use windows registry.
}
#endif
home = [home stringByAppendingPathComponent: defaultsDir];
if (NO == [defaultsDir isAbsolutePath])
{
NSString *home = NSHomeDirectoryForUser(userName);
return home;
defaultsDir = [home stringByAppendingPathComponent: defaultsDir];
}
return defaultsDir;
}
NSArray *