diff --git a/ChangeLog b/ChangeLog index 34a20f9d2..9844fcf96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-04-06 Richard Frith-Macdonald + + * 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 * Tools/AGSParser.m: Fix error parsing sequence of protocol names diff --git a/Source/Additions/GSXML.m b/Source/Additions/GSXML.m index 37166d009..5f9362447 100644 --- a/Source/Additions/GSXML.m +++ b/Source/Additions/GSXML.m @@ -3829,7 +3829,7 @@ static BOOL warned = NO; if (warned == NO) { warned = YES; NSLog(@"WARNING, use #ifdef HAVE_LIBXSLT /** * Performs an XSLT transformation on the specified file using the - * sytelsheet provided.
+ * stylesheet provided.
* * Returns an autoreleased GSXMLDocument containing the transformed * 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 - * sytelsheet and parameters provided. See the libxslt documentation + * stylesheet and parameters provided. See the libxslt documentation * for details of the supported parameters.
* * 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 - * sytelsheet provided.
+ * stylesheet provided.
* * Returns an autoreleased GSXMLDocument containing the transformed * 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 - * sytelsheet and parameters provided.See the libxslt documentation + * stylesheet and parameters provided.See the libxslt documentation * for details of the supported parameters.
* * Returns an autoreleased GSXMLDocument containing the transformed diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 407599f07..e5bf7e913 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -737,6 +737,8 @@ static NSString *pathForUser(NSString *user) return [self initWithContentsOfFile: path]; } +BOOL read_only = NO; + /** * * 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 '%@' " @" read-only\n", path, _defaultsDatabase); + } else if ([mgr fileExistsAtPath: path isDirectory: &flag] == NO && flag == NO) { @@ -1441,14 +1444,31 @@ static BOOL isPlistObject(id o) initWithContentsOfFile: _defaultsDatabase]; if (newDict == nil) { - NSLog(@"Unable to load defaults from '%@'", _defaultsDatabase); - if (wasLocked == NO) + if (_fileLock == nil) { - [_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; } }