[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUStep parsing OSX binary plist changed?
From: |
David Chisnall |
Subject: |
Re: GNUStep parsing OSX binary plist changed? |
Date: |
Fri, 29 Jan 2010 18:34:18 +0000 |
Do we even support the OS X binary plist format? It's undocumented, and you
can use plutil on OS X to create a property list in a documented format from
one.
David
On 28 Jan 2010, at 15:26, Fred Kiefer wrote:
> Your code is not printing the actual format of the plist, rather it
> prints the class of the extracted object. And if this is a string in
> GNUstep then the call to objectForKey: is bound to fail.
>
> Most likely the plist format used by Safari has changed or your aren't
> looking at the same file in both cases.
>
> This could be easily investigated if you mail the plist in question (or
> even better a very simple one that reproduces the problem). I tried to
> find the History.plist on my Mac, but failed. The only thing I found was
> a History directory for Safari with plenty of files in it. All of them
> looked like normal plists to me.
>
> Fred
>
> Am 28.01.2010 02:30, schrieb L Zee:
>> I recently discovered that a one of my GNUStep programs that parses
>> Safari History.plist files can't parse the files in new versions of
>> safari.
>>
>> As a test ,when I compile and run the following code on OSX using a
>> plist file, it tells me the "plist class" of the plist is "Detected
>> format as NSCFDictionary".
>>
>> When I run the same code compiled on GNUStep that's bundled with
>> ubuntu 9.04, using the same plist file, it tells me the "plist class"
>> is "Detected format as GSCBufferString" and the program aborts.
>>
>> Any ideas on how I can continue to parse these files using GNUstep?
>>
>> Thanks
>>
>> ----------------------------------
>>
>>
>> #include <Foundation/Foundation.h>
>>
>> // MAIN int main (int argc, const char * argv[]) {
>>
>> // Defs. NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]
>> init]; NSData *plistData; NSString *error; NSPropertyListFormat
>> format; id plist; id dict_val;
>>
>>
>> plistData = [NSData dataWithContentsOfFile: [NSString
>> stringWithCString: argv[1]]];
>>
>> plist = [NSPropertyListSerialization propertyListFromData:plistData
>> mutabilityOption:NSPropertyListMutableContainers format:&format
>> errorDescription:&error];
>>
>> NSLog(@"%@",plist); NSLog(@"Detected format as %@", [plist
>> class],plist) ;
>>
>>
>> dict_val = [plist objectForKey: @"WebHistoryDates"];
>>
>> NSLog(@"%@",dict_val);
>>
>>
>> [pool release]; return 0; }
>
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnustep
-- Sent from my STANTEC-ZEBRA