objective c - Always appending file extensions in NSDocument -
objective c - Always appending file extensions in NSDocument -
what best way ensure file saved disk (or icloud) contains default file extension our document format in nsdocument
based cocoa app?
background: users can load legacy files app still utilize type-creator-codes.
with auto-saving enabled in our app need create sure file has file extension added it's written disk (following kind of changes) our cocoa app - or app won't able open (with neither type-creator-code nor file extension).
if got right i'd overwrite nsdocumentcontroller's
open method
- (void)opendocumentwithcontentsofurl:(nsurl *)url display:(bool)displaydocument completionhandler:(void (^)(nsdocument *document, bool documentwasalreadyopen, nserror *error))completionhandler { if(!url.pathextension isequaltostring:@"xyz") url = url urlbyappendingpathextension:@"xyz"]; [super opendocumentwithcontentsofurl:url display:displaydocument completionhandler:completionhandler]; }
note: written inline
objective-c cocoa file-type nsdocument nsapplication
Comments
Post a Comment