[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUStep parsing OSX binary plist changed?
From: |
Fred Kiefer |
Subject: |
Re: GNUStep parsing OSX binary plist changed? |
Date: |
Thu, 28 Jan 2010 16:26:57 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 SUSE/3.0.0-1.1.1 Thunderbird/3.0 |
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; }