mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +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
|
@ -1,3 +1,12 @@
|
||||||
|
2011-12-17 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSUserDefaults.m:
|
||||||
|
Whenever we synchronize in a state where we have changes to write,
|
||||||
|
but are in read-only mode (no database existed on startup, or we
|
||||||
|
couldn't create the lock file on startup), check to see if the
|
||||||
|
database is now writable (we can create the lock file).
|
||||||
|
Should fix problem where new defaults files were not getting created.
|
||||||
|
|
||||||
2011-12-15 Richard Frith-Macdonald <rfm@gnu.org>
|
2011-12-15 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSProcessInfo.m:
|
* Source/NSProcessInfo.m:
|
||||||
|
|
|
@ -1724,10 +1724,6 @@ static BOOL isPlistObject(id o)
|
||||||
NSFileManager *mgr;
|
NSFileManager *mgr;
|
||||||
NSDictionary *attr;
|
NSDictionary *attr;
|
||||||
|
|
||||||
if (nil == _fileLock)
|
|
||||||
{
|
|
||||||
return NO; // Database did not exist on startup.
|
|
||||||
}
|
|
||||||
mgr = [NSFileManager defaultManager];
|
mgr = [NSFileManager defaultManager];
|
||||||
attr = [mgr fileAttributesAtPath: _defaultsDatabase traverseLink: YES];
|
attr = [mgr fileAttributesAtPath: _defaultsDatabase traverseLink: YES];
|
||||||
if (lastSyncDate == nil)
|
if (lastSyncDate == nil)
|
||||||
|
@ -1776,7 +1772,18 @@ static BOOL isPlistObject(id o)
|
||||||
if (_changedDomains != nil
|
if (_changedDomains != nil
|
||||||
|| YES == [self wantToReadDefaultsSince: saved])
|
|| 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)
|
if ([self _lockDefaultsFile: &wasLocked] == NO)
|
||||||
{
|
{
|
||||||
result = NO;
|
result = NO;
|
||||||
|
@ -1788,10 +1795,14 @@ static BOOL isPlistObject(id o)
|
||||||
NSFileManager *mgr;
|
NSFileManager *mgr;
|
||||||
|
|
||||||
haveNewDomain = [self _readDefaults];
|
haveNewDomain = [self _readDefaults];
|
||||||
|
if (YES == haveNewDomain)
|
||||||
|
{
|
||||||
|
DESTROY(_dictionaryRep);
|
||||||
|
}
|
||||||
|
|
||||||
mgr = [NSFileManager defaultManager];
|
mgr = [NSFileManager defaultManager];
|
||||||
|
|
||||||
if (_changedDomains != nil)
|
if (_changedDomains != nil && NO == [self _readOnly])
|
||||||
{
|
{
|
||||||
GSPersistentDomain *domain;
|
GSPersistentDomain *domain;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue