Property list output fixups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10851 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2001-09-08 05:11:58 +00:00
parent c3c10cf464
commit ddd9a6e299
6 changed files with 62 additions and 60 deletions

View file

@ -728,25 +728,14 @@ static int compare(id elem1, id elem2, void* context)
- (NSString*) descriptionWithLocale: (NSDictionary*)locale
indent: (unsigned int)level
{
extern BOOL GSMacOSXCompatiblePropertyLists();
NSMutableString *result;
if (GSMacOSXCompatiblePropertyLists() == YES)
{
extern NSString *GSXMLPlMake(id obj, NSDictionary *loc, unsigned lev);
return GSXMLPlMake(self, locale, level);
}
else
{
NSMutableString *result;
result = [[NSMutableString alloc] initWithCapacity: 20*[self count]];
result = AUTORELEASE(result);
[self descriptionWithLocale: locale
indent: level
to: (id<GNUDescriptionDestination>)result];
return result;
}
result = [[NSMutableString alloc] initWithCapacity: 20*[self count]];
result = AUTORELEASE(result);
[self descriptionWithLocale: locale
indent: level
to: (id<GNUDescriptionDestination>)result];
return result;
}
static NSString *indentStrings[] = {
@ -841,11 +830,29 @@ static NSString *indentStrings[] = {
- (BOOL) writeToFile: (NSString *)path 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 writeToFile: path atomically: useAuxiliaryFile];
}