html and postscript viewer

Ryan Schmidt ryandesign at macports.org
Wed Mar 30 18:37:42 PDT 2016


> On Mar 30, 2016, at 8:36 PM, Kevin Walzer <kw at codebykevin.com> wrote:
> 
> On 3/30/16 9:28 PM, Ryan Schmidt wrote:
>> /usr/bin/open is not necessarily suitable. For example, I have configure my system so that if I `open` a .html file, it opens into my text editor, because I frequently edit html files. However, if another program is trying to open a web page, then I want that web page to open in my web browser, not my text editor.
>> 
> 
> You are technically correct, but I suspect your use case is going to be applicable only for a small group of users who are also developers.
> 

It applies to any user who has changed the file association for .html files. There's no reason to inconvenience that subset of users when a solution exists.


> /usr/bin/open is the command-line interface to the LaunchServices API, which is supposed to handle all this. I am not aware of any clean way to query Safari's preferences to determine the default browser without groveling through plist files, or perhaps AppleScript.
> 
> (Looking on the web, I see your openbrowser script does exactly that--grinds through plist files via Perl--but that introduces an additional dependency. I'd suggest that using a system-bundled tool is almost always better. It's certainly simpler.)




More information about the macports-dev mailing list