2009-02-28 Eli Barzilay <eli at barzilay.org>: > On Feb 28, Thomas Chust wrote: >> [...] >> out of curiosity: Is there any particular reason why PLT Scheme >> doesn't use the LaunchServices API to open the URL instead of >> executing an external command? > > Much easier to implement, and extremely negligible cost (compared to > starting your browser and making it render a documentation page). > [...]
Hello, using LaunchServices, you would need exactly two C API calls: One to create the URL object (http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLRef/Reference/reference.html#//apple_ref/c/func/CFURLCreateWithBytes) and one to open the URL (http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/Reference/reference.html#//apple_ref/c/func/LSOpenCFURLRef) -- this is hardly more complicated to implement than creating a command line with proper escaping and launching an external program. You are right, though, that the cost is negligible and as long as it works correctly nobody cares about the implementation. I was just curious why the special OS API is used to open URLs on Windows but not on MacOS X. Using a C API directly often saves you from nasty shell quoting issues and the problem described by the OP looked to me like it could have been such an issue. However, since the further discussion in this thread showed that the problem is probably not PLT Scheme's fault, it is questionable whether using the C API would make the problem go away. Unfortunately I can't boot my installation of MacOS X at the moment to give it a try :-( cu, Thomas -- When C++ is your hammer, every problem looks like your thumb.
