mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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:
parent
c3c10cf464
commit
ddd9a6e299
6 changed files with 62 additions and 60 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue