[57831] trunk/dports/sysutils/openbrowser

ryandesign at macports.org ryandesign at macports.org
Thu Sep 17 00:57:57 PDT 2009


Revision: 57831
          http://trac.macports.org/changeset/57831
Author:   ryandesign at macports.org
Date:     2009-09-17 00:57:54 -0700 (Thu, 17 Sep 2009)
Log Message:
-----------
openbrowser: stop using p5-mac-carbon so it builds on Snow Leopard; closes #21044

Modified Paths:
--------------
    trunk/dports/sysutils/openbrowser/Portfile
    trunk/dports/sysutils/openbrowser/files/openbrowser

Modified: trunk/dports/sysutils/openbrowser/Portfile
===================================================================
--- trunk/dports/sysutils/openbrowser/Portfile	2009-09-17 07:56:49 UTC (rev 57830)
+++ trunk/dports/sysutils/openbrowser/Portfile	2009-09-17 07:57:54 UTC (rev 57831)
@@ -3,7 +3,7 @@
 PortSystem              1.0
 
 name                    openbrowser
-version                 1.0
+version                 1.0.1
 categories              sysutils
 platforms               macosx
 maintainers             ryandesign
@@ -20,7 +20,7 @@
 
 distfiles
 
-depends_run             port:p5-mac-carbon
+depends_run             port:p5-mac-propertylist
 
 universal_variant       no
 

Modified: trunk/dports/sysutils/openbrowser/files/openbrowser
===================================================================
--- trunk/dports/sysutils/openbrowser/files/openbrowser	2009-09-17 07:56:49 UTC (rev 57830)
+++ trunk/dports/sysutils/openbrowser/files/openbrowser	2009-09-17 07:57:54 UTC (rev 57831)
@@ -11,15 +11,25 @@
 # e.g. a text editor.
 #
 # usage: openbrowser [ file | url ] [ ... ]
-#
-# Thanks to John Gruber for coincidentally posting the code I'd been
-# seeking for reading the http helper from Internet Config.
-# http://daringfireball.net/2009/02/do_shell_script_premature_optimization
 
-use Mac::InternetConfig;
+sub GetBrowser {
+	use Mac::PropertyList qw(parse_plist_file);
+	my $browser = "com.apple.safari";
+	my $plist_file = "$ENV{HOME}/Library/Preferences/com.apple.LaunchServices.plist";
+	$data = parse_plist_file($plist_file);
+	if ($data) {
+		for my $handler ($data->{"LSHandlers"}->value()) {
+			$handler->{"LSHandlerURLScheme"} || next;
+			"http" eq $handler->{"LSHandlerURLScheme"}->value() || next;
+			$browser = $handler->{"LSHandlerRoleAll"}->value();
+			last;
+		}
+	}
+	return $browser;
+}
 
-$browser = +(GetICHelper "http")[1];
- at open_args = ("-a", $browser);
+my $browser = GetBrowser();
+ at open_args = ("-b", $browser);
 push @open_args, @ARGV;
 
 exec "open", @open_args;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090917/e7cfc3d7/attachment.html>


More information about the macports-changes mailing list