[Pyobjc-dev] Supporting (NSString **) API (and the like)
Brought to you by:
ronaldoussoren
From: Bill B. <bb...@co...> - 2002-11-26 16:37:52
|
I ran across the need to call... - (BOOL)getInfoForFile:(NSString *)fullPath application:(NSString **)appName type:(NSString **)type; ... today. Obviously, the appName and type parameters pose a problem. Instead of trying to magically wrap 'em, how about simply creating a category on [in this case] NSWorkspace that offers... - (NSDictionary *) pyobjcGetInfoForFile: (NSString *) fullPath; ... and the implementation simply returns a dictionary with the keys 'application' and 'type'? The 'pyobjc' prefix will prevent namespace collisions and using a category will continue to associate the functionality with the class. (I did the same thing years ago when writing PyServices w/PyObjC under OpenStep 4.2 -- it works quite well and is easy to maintain. Since we pretty much have to do case-by-case support on the methods anyway, this doesn't add that much maintenance overhead.) This would seem to be easier than the implementation found in _AppKitMapping.m...? I committed changes to setup.py and the AppKit module as an example; see NSWorkspaceSupport.m in Modules/AppKit/. If there is a better way, feel free to rip it out and make changes. I went ahead and committed because (a) the change is isolated, (b) it works with a minimal amount of code that is quite straightforward in its implementation and (c) I needed support for NSWorkspace in something else I'm working on (as long as support continues to exist in whatever form, I don't care what the implementation looks like). b.bum |