Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hs.plist.readString() #2223

Closed
latenitefilms opened this issue Oct 27, 2019 · 0 comments · Fixed by #2226
Closed

Add hs.plist.readString() #2223

latenitefilms opened this issue Oct 27, 2019 · 0 comments · Fixed by #2226

Comments

@latenitefilms
Copy link
Contributor

Currently hs.plist.read(path) only allows you to read property lists from external files. It could be handy if you could also read a property list from a string.

Maybe related:
https://developer.apple.com/documentation/foundation/nsstring/1413115-propertylist?language=objc

Maybe useful:

NSData* plistData = [source dataUsingEncoding:NSUTF8StringEncoding];
NSString *error;
NSPropertyListFormat format;
NSDictionary* plist = [NSPropertyListSerialization propertyListWithData:plistData mutabilityOption:NSPropertyListImmutable format:&format errorDescription:&error];
NSLog( @"plist is %@", plist );
if(!plist){
    NSLog(@"Error: %@",error);
    [error release];
}
latenitefilms added a commit to latenitefilms/hammerspoon that referenced this issue Oct 31, 2019
cmsj pushed a commit that referenced this issue Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant