Hi,

Thanks for responding and clarifying it is printing the class of the object. I 
am expecting the object to be a NSDicrionary object.
I have attached the History.plist file, and additional info on the the results 
using this file.


The below code on Linux w/GNUStep (native Ubuntu 9.04)
$>md5sum ~/Desktop/History.plist

656ce0c8705d8c38b95a22356b6cfd9a

$> ./test ~/Desktop/History.plist


2010-01-29 13:15:26.594 safari_hist[3276] WebHistoryFileVersion
2010-01-29 13:15:26.604 safari_hist[3276] Detected format as GSCBufferString
Aborted


The same code (below) on OSX with the same History.plist file

maccy$ md5 ~Desktop/History.plist

MD5 (History.plist) = 656ce0c8705d8c38b95a22356b6cfd9a



maccy$ ./test ~/Desktop/History.plist

2010-01-29 13:17:30.132 test[1019] {

    WebHistoryDates = (

        {

            "" = "http://www.apple.com/startpage/";;

            D = (2);

            lastVisitedDate = "286477969.8";

            title = "Apple - Start";

            visitCount = 2;

        }

    );

    WebHistoryFileVersion = 1;

}

2010-01-29 13:17:30.133 test[1019] Detected format as NSCFDictionary

2010-01-29 13:17:30.133 test[1019] 1

Thanks for your help.

 
> Date: Thu, 28 Jan 2010 16:26:57 +0100
> From: [email protected]
> To: [email protected]
> CC: [email protected]
> Subject: Re: GNUStep parsing OSX binary plist changed?
> 
> 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; }
> 
                                          
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/196390710/direct/01/

Attachment: History.plist
Description: Binary data

_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to