NSUserDefaults fix for read-only filesystem. Comment type fixes in GSXML.m

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19034 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-04-06 06:27:32 +00:00
parent 8c26943b86
commit b005bcf6ba
3 changed files with 36 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2004-04-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Modified to operate on a read-only
filesystem where the defaults database is missing. Application
defaults and command line settings should still work.
2004-04-02 Richard Frith-Macdonald <rfm@gnu.org> 2004-04-02 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/AGSParser.m: Fix error parsing sequence of protocol names * Tools/AGSParser.m: Fix error parsing sequence of protocol names

View file

@ -3829,7 +3829,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
#ifdef HAVE_LIBXSLT #ifdef HAVE_LIBXSLT
/** /**
* Performs an XSLT transformation on the specified file using the * Performs an XSLT transformation on the specified file using the
* sytelsheet provided.<br /> * stylesheet provided.<br />
* *
* Returns an autoreleased GSXMLDocument containing the transformed * Returns an autoreleased GSXMLDocument containing the transformed
* XML, or nil on failure. * XML, or nil on failure.
@ -3844,7 +3844,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
/** /**
* Performs an XSLT transformation on the specified file using the * Performs an XSLT transformation on the specified file using the
* sytelsheet and parameters provided. See the libxslt documentation * stylesheet and parameters provided. See the libxslt documentation
* for details of the supported parameters.<br /> * for details of the supported parameters.<br />
* *
* Returns an autoreleased GSXMLDocument containing the transformed * Returns an autoreleased GSXMLDocument containing the transformed
@ -3884,7 +3884,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
} }
/** /**
* Performs an XSLT transformation on the specified file using the * Performs an XSLT transformation on the specified file using the
* sytelsheet provided.<br /> * stylesheet provided.<br />
* *
* Returns an autoreleased GSXMLDocument containing the transformed * Returns an autoreleased GSXMLDocument containing the transformed
* XML, or nil on failure. * XML, or nil on failure.
@ -3899,7 +3899,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use
/** /**
* Performs an XSLT transformation on the specified file using the * Performs an XSLT transformation on the specified file using the
* sytelsheet and parameters provided.See the libxslt documentation * stylesheet and parameters provided.See the libxslt documentation
* for details of the supported parameters.<br /> * for details of the supported parameters.<br />
* *
* Returns an autoreleased GSXMLDocument containing the transformed * Returns an autoreleased GSXMLDocument containing the transformed

View file

@ -737,6 +737,8 @@ static NSString *pathForUser(NSString *user)
return [self initWithContentsOfFile: path]; return [self initWithContentsOfFile: path];
} }
BOOL read_only = NO;
/** /**
* <init /> * <init />
* Initializes defaults for the specified path. Returns an object with * Initializes defaults for the specified path. Returns an object with
@ -768,6 +770,7 @@ static NSString *pathForUser(NSString *user)
{ {
NSWarnMLog(@"Path '%@' is not writable - making user defaults for '%@' " NSWarnMLog(@"Path '%@' is not writable - making user defaults for '%@' "
@" read-only\n", path, _defaultsDatabase); @" read-only\n", path, _defaultsDatabase);
} }
else if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO && flag == NO) else if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO && flag == NO)
{ {
@ -1441,14 +1444,31 @@ static BOOL isPlistObject(id o)
initWithContentsOfFile: _defaultsDatabase]; initWithContentsOfFile: _defaultsDatabase];
if (newDict == nil) if (newDict == nil)
{ {
NSLog(@"Unable to load defaults from '%@'", _defaultsDatabase); if (_fileLock == nil)
if (wasLocked == NO)
{ {
[_fileLock unlock]; /*
isLocked = NO; * Running with no readable user defaults ... but we were
* initialised that way (possibly on a read-only filesystem)
* so we just continue as best we can.
*/
newDict = [[NSMutableDictionaryClass allocWithZone: [self zone]]
initWithCapacity: 4];
}
else
{
/*
* The defaults system has become unreadable singe we started...
* probably a severe error of some sort
*/
NSLog(@"Unable to load defaults from '%@'", _defaultsDatabase);
if (wasLocked == NO)
{
[_fileLock unlock];
isLocked = NO;
}
[_lock unlock];
return NO;
} }
[_lock unlock];
return NO;
} }
} }