ebarnard / rust-plist

A rusty plist parser.
MIT License
71 stars 42 forks source link

Read .pbxproj file #42

Closed fstephany closed 3 months ago

fstephany commented 5 years ago

I'm trying to read a .pbxproj file. The annoying part of it is that Xcode does not use the XML or binary format for this plist but an older variant (coming from NeXT it seems).

See an example from NetNewsWire. And here's a quite exhaustive overview.

I understand the the appeal to support these files is pretty limited but is it something that you might consider? If not, no worries, I'll go with a custom pest parser ;)

ebarnard commented 5 years ago

I'd happily support old style ASCII plists but to be honest I don't think I'll have the time or motivation to implement a parser for them myself.

Also, in case you don't know, if you're on a mac and want a quick solution plutil -convert xml1 XXXX.pbxproj will convert the file to an XML plist (note that it will overwrite the original file) which you could read with this library.

fstephany commented 5 years ago

I'd happily support old style ASCII plists but to be honest I don't think I'll have the time or motivation to implement a parser for them myself.

That's alright ;)

Thanks for the plutil idea. It seems to be there on Ubuntu as well but always return Unimplemented. I'll let you know if I end up writing a custom parser for it.

Thanks!

fstephany commented 4 years ago

I've finally built a quite naive AsciiReader. It's rough around the edges but seems to do the trick for the use case I had in mind.

Per the [Apple docs], there are only 4 event types (dictionary, array, Strings, binary data). It seems that they only support Read so I didn't bother to make a writer.

I'll polish it a bit and add support for binary data. Should I then make a PR or do you want to keep it outside the scope of this crate?

ebarnard commented 4 years ago

Great. I'd be very happy for this create to support ASCII plists.

cmyr commented 4 years ago

just to chime in: there's a working string plist parser at https://git.sr.ht/~raph/interp-toy/tree/master/glyphstool/src/plist.rs, if that's useful in any way.

fstephany commented 4 years ago

Oh cool, thanks for the pointer @cmyr I'll check it out over the weekend and see if it's better than my naive implementation.

Artoria2e5 commented 3 years ago

I recommend renaming the "Ascii" format to OpenStep, to clarify its difference from the derived GnuStep format which has types as expressive as the XML version. It's quite a lot more pleasant to write by hand than the XML, really.

ebarnard commented 3 months ago

Released in v1.7.0