mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Try to ensure new defaults files are created as needed.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34307 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c471992651
commit
13e98151ab
2 changed files with 26 additions and 6 deletions
|
@ -1724,10 +1724,6 @@ static BOOL isPlistObject(id o)
|
|||
NSFileManager *mgr;
|
||||
NSDictionary *attr;
|
||||
|
||||
if (nil == _fileLock)
|
||||
{
|
||||
return NO; // Database did not exist on startup.
|
||||
}
|
||||
mgr = [NSFileManager defaultManager];
|
||||
attr = [mgr fileAttributesAtPath: _defaultsDatabase traverseLink: YES];
|
||||
if (lastSyncDate == nil)
|
||||
|
@ -1776,7 +1772,18 @@ static BOOL isPlistObject(id o)
|
|||
if (_changedDomains != nil
|
||||
|| YES == [self wantToReadDefaultsSince: saved])
|
||||
{
|
||||
DESTROY(_dictionaryRep);
|
||||
/* If we want to write but are currently read-only, try to
|
||||
* create the path to make things writable.
|
||||
*/
|
||||
if (_changedDomains != nil && YES == [self _readOnly])
|
||||
{
|
||||
NSString *path = lockPath(_defaultsDatabase, NO);
|
||||
|
||||
if (nil != path)
|
||||
{
|
||||
_fileLock = [[NSDistributedLock alloc] initWithPath: path];
|
||||
}
|
||||
}
|
||||
if ([self _lockDefaultsFile: &wasLocked] == NO)
|
||||
{
|
||||
result = NO;
|
||||
|
@ -1788,10 +1795,14 @@ static BOOL isPlistObject(id o)
|
|||
NSFileManager *mgr;
|
||||
|
||||
haveNewDomain = [self _readDefaults];
|
||||
if (YES == haveNewDomain)
|
||||
{
|
||||
DESTROY(_dictionaryRep);
|
||||
}
|
||||
|
||||
mgr = [NSFileManager defaultManager];
|
||||
|
||||
if (_changedDomains != nil)
|
||||
if (_changedDomains != nil && NO == [self _readOnly])
|
||||
{
|
||||
GSPersistentDomain *domain;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue