Hey! We run sketchtool to export images from the active document, but this fails if the document is unsaved. I'd like to ask the user to save the document before they run the plugin. How do we detect it?
I think I saw someone else post here that you can check if document.sketchObject.fileURL() is null or not.
Thanks @kevgski , but i just tried it out -- for unsaved documents it returns a "Library/Mobile Documents" path. Also to clarify my question, I'd want to know if there are any unsaved changes in the document (even if it was saved before).
These properties on NSDocument might be useful:
That works beautifully with context.document.isDraft() || context.document.isDocumentEdited() to handle both cases. Thanks @abynim
context.document.isDraft() || context.document.isDocumentEdited()