Fix for writing plists to URLs

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10852 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-09-08 05:15:19 +00:00
parent 898452270d
commit 6e1ce3035f
3 changed files with 41 additions and 4 deletions

View file

@ -3,8 +3,9 @@
* Source/GSCompatibility.m: GSXMLPlMake() unused argument removed.
* Source/NSData.m: Unused and commented out XML plist code removed.
* Source/NSString.m: ditto
* Source/NSArray.m: Generate XML plists only when writing to file,
not for the -description... methods. This is what MacOS-X does.
* Source/NSArray.m: Generate XML plists only when writing to file
or to URL, not for the -description... methods.
This is what MacOS-X does.
* Source/NSDictionary.m: ditto
2001-09-05 Adam Fedor <fedor@gnu.org>

View file

@ -859,11 +859,29 @@ static NSString *indentStrings[] = {
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
{
extern BOOL GSMacOSXCompatiblePropertyLists();
NSDictionary *loc;
NSString *desc;
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
desc = [self descriptionWithLocale: loc indent: 0];
if (GSMacOSXCompatiblePropertyLists() == YES)
{
extern NSString *GSXMLPlMake(id obj, NSDictionary *loc);
desc = GSXMLPlMake(self, loc);
}
else
{
NSMutableString *result;
result = [[NSMutableString alloc] initWithCapacity: 20*[self count]];
result = AUTORELEASE(result);
[self descriptionWithLocale: loc
indent: 0
to: (id<GNUDescriptionDestination>)result];
desc = result;
}
return [desc writeToURL: url atomically: useAuxiliaryFile];
}

View file

@ -651,11 +651,29 @@ compareIt(id o1, id o2, void* context)
- (BOOL) writeToURL: (NSURL *)url atomically: (BOOL)useAuxiliaryFile
{
extern BOOL GSMacOSXCompatiblePropertyLists();
NSDictionary *loc;
NSString *desc;
loc = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
desc = [self descriptionWithLocale: loc indent: 0];
if (GSMacOSXCompatiblePropertyLists() == YES)
{
extern NSString *GSXMLPlMake(id obj, NSDictionary *loc);
desc = GSXMLPlMake(self, loc);
}
else
{
NSMutableString *result;
result = AUTORELEASE([[NSMutableString alloc] initWithCapacity:
20*[self count]]);
[self descriptionWithLocale: loc
indent: 0
to: (id<GNUDescriptionDestination>)result];
desc = result;
}
return [desc writeToURL: url atomically: useAuxiliaryFile];
}