Subject: | nytprofhtml --open fails on KDE |
"nytprofhtml --open" will fail on KDE (KDE4 with non-standard Opera), as the code is broken
failure line:
sh: openURL: command not found
$ perl -MV=Devel::NYTProf
Devel::NYTProf
/pro/lib/perl5/site_perl/5.20.0/x86_64-linux-thread-multi-ld/Devel/NYTProf.pm: 5.06
This is perl 5, version 20, subversion 0 (v5.20.0) built for x86_64-linux-thread-multi-ld
line 1317 and on
my @try = qw(xdg-open);
if ($ENV{BROWSER}) {
push(@try, split(/:/, $ENV{BROWSER}));
}
else {
push(@try, qw(firefox galeon mozilla opera netscape));
}
unshift(@try, "kfmclient") if $ENV{KDE_FULL_SESSION};
unshift(@try, "gnome-open") if $ENV{GNOME_DESKTOP_SESSION_ID};
# here @try is qw( kfmclient xdg-open firefox opera )
for (grep { have_prog($_) } @try) {
if ($_ eq "kfmclient") {
$BROWSER .= " openURL %s"; # <= bad code
}
elsif ($_ eq "gnome-open" || $_ eq "opera") {
$BROWSER = "$_ %s";
}
else {
$BROWSER = "$_ %s &";
}
last;
}
}
# here $BROWSER = " openURL %s"
Obviously, the line should have been
$BROWSER = "$_ openURL %s";
Which is almost never what is wanted:
$ xdg-mime query filetype nytprof/index.html
text/html
$ xdg-mime query default text/html
Opera.desktop
Using KDE's "systemsettings" has Opera on top as possible webbrowsers, but kfmclient still opens with Konqueror.
IMHO, "xdg-open" should always be first as it is so widely adopted now
FWIW Opening index.html from dolphin will also start Opera