| 1 | package UI::Dialog::Backend::Nautilus; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # Copyright (C) 2004-2016 Kevin C. Krinke <kevin@krinke.ca> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # This library is free software; you can redistribute it and/or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # modify it under the terms of the GNU Lesser General Public | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # License as published by the Free Software Foundation; either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # version 2.1 of the License, or (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # This library is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # Lesser General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # You should have received a copy of the GNU Lesser General Public | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # License along with this library; if not, write to the Free Software | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use UI::Dialog::Backend; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | ▶ | use FileHandle; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use vars qw( $VERSION @ISA ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | @ISA = qw( UI::Dialog::Backend ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | $VERSION = '1.20'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1 | ▶ | my $proto = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=18.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | $self->{'_opts'}->{'bin'} ||= $self->_find_bin('nautilus'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("nautilus")
MC/DC0%0/2
$self->{"_opts"}{"bin"} ||= $self->_find_bin("nautilus")
$self->{"_opts"}{"bin"}
$self->_find_bin("nautilus")
Truth table33%1/3
A ||= B
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("nautilus")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | ▶ | $self->{'_opts'}->{'bin'} ||= $self->_find_bin('caja'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->{"_opts"}{"bin"} ||= $self->_find_bin("caja")
MC/DC0%0/2
$self->{"_opts"}{"bin"} ||= $self->_find_bin("caja")
$self->{"_opts"}{"bin"}
$self->_find_bin("caja")
Truth table33%1/3
A ||= B
A= $self->{"_opts"}{"bin"}B= $self->_find_bin("caja")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1 | ▶ | unless (-x $self->{'_opts'}->{'bin'}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | croak("the nautilus binary could not be found at: ".$self->{'_opts'}->{'bin'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | return($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | #: Internal Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | #: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | sub _debug { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | my $mesg = shift() || 'unknown msg'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'unknown msg'
MC/DC0%0/1
shift() || 'unknown msg'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $logfile = '/tmp/nautilus_debug.tmp'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | if (open(NAUTILUSLOGFILE,">>".$logfile)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | print NAUTILUSLOGFILE $mesg."\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | close(NAUTILUSLOGFILE); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | sub _is_env { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_env: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | return(1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | unless not $ENV{'NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | and not $ENV{'NAUTILUS_SCRIPT_SELECTED_URIS'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | and not $ENV{'NAUTILUS_SCRIPT_CURRENT_URI'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | and not $ENV{'NAUTILUS_SCRIPT_WINDOW_GEOMETRY'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"} or $ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"} or $ENV{"NAUTILUS_SCRIPT_CURRENT_URI"} or $ENV{"NAUTILUS_SCRIPT_WINDOW_GEOMETRY"}
$ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"} or $ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"} or $ENV{"NAUTILUS_SCRIPT_CURRENT_URI"}
$ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"} or $ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"}
MC/DC0%0/4
$ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"} or $ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"} or $ENV{"NAUTILUS_SCRIPT_CURRENT_URI"} or $ENV{"NAUTILUS_SCRIPT_WINDOW_GEOMETRY"}
$ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"}
$ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"}
$ENV{"NAUTILUS_SCRIPT_CURRENT_URI"}
$ENV{"NAUTILUS_SCRIPT_WINDOW_GEOMETRY"}
Truth table0%0/5
A or B or C or D
A= $ENV{"NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"}B= $ENV{"NAUTILUS_SCRIPT_SELECTED_URIS"}C= $ENV{"NAUTILUS_SCRIPT_CURRENT_URI"}D= $ENV{"NAUTILUS_SCRIPT_WINDOW_GEOMETRY"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | #:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | #: Public (Nautilus Shell Script) Methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | #: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | #: Thanks to URI::Escape. Because it's not part of the core Perl, we need to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | #: include it here. UI::Dialog shouldn't force other dependancies. This version | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | #: is modified to strip the prefixing protocol indicator. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | sub uri_unescape { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Note from RFC1630: "Sequences which start with a percent sign | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # but are not followed by two hexadecimal characters are reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # for future extension" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uri_unescape: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $str = shift(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | if (@_ && wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and wantarray
MC/DC0%0/2
@_ and wantarray
@_
wantarray
Truth table0%0/3
A and B
A= @_B= wantarray
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # not executed for the common case of a single argument | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my @str = ($str, @_); # need to copy | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | foreach (@str) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | s!^\w+\://!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return(@str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | $str =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg if defined $str; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | $str =~ s!^\w+\://!!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | return($str); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | #NAUTILUS_SCRIPT_SELECTED_FILE_PATHS: newline-delimited paths for selected files (only if local) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | sub paths { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
paths: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | if ($self->_is_env()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | return(split(/\n/,$ENV{'NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'})) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | unless not $ENV{'NAUTILUS_SCRIPT_SELECTED_FILE_PATHS'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my @paths = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | foreach my $uri ($self->uris()) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $path = $uri; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | my $desktop = $self->_get_desktop_dir(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $path =~ s!^x\-nautilus\-desktop\:///trash!$ENV{'HOME'}/.Trash!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | $path =~ s!^x\-nautilus\-desktop\://!$desktop!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | push(@paths,$self->uri_unescape($path)); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | return(@paths); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | } else { return(0); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #NAUTILUS_SCRIPT_SELECTED_URIS: newline-delimited URIs for selected files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | sub uris { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uris: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ($self->_is_env()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | return(split(/\n/,$ENV{'NAUTILUS_SCRIPT_SELECTED_URIS'})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | } else { return(0); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | #NAUTILUS_SCRIPT_CURRENT_URI: URI for current location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sub path { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
path: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | return('error') unless $self->_is_env(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | my $URI = $ENV{'NAUTILUS_SCRIPT_CURRENT_URI'} || ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'NAUTILUS_SCRIPT_CURRENT_URI'} || ''
MC/DC0%0/1
$ENV{'NAUTILUS_SCRIPT_CURRENT_URI'} || ''
$ENV{'NAUTILUS_SCRIPT_CURRENT_URI'}
Truth table0%0/2
A
A= $ENV{'NAUTILUS_SCRIPT_CURRENT_URI'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $desktop = $self->_get_desktop_dir(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $URI =~ s!^x\-nautilus\-desktop\:///trash!$ENV{'HOME'}/.Trash!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $URI =~ s!^x\-nautilus\-desktop\://!$desktop!; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | return(($self->uri_unescape($URI)||$URI)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->uri_unescape($URI) || $URI
MC/DC0%0/2
$self->uri_unescape($URI) || $URI
$self->uri_unescape($URI)
$URI
Truth table0%0/3
A || B
A= $self->uri_unescape($URI)B= $URI
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | #NAUTILUS_SCRIPT_CURRENT_URI: URI for current location | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | sub uri { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uri: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | return($ENV{'NAUTILUS_SCRIPT_CURRENT_URI'}) if $self->_is_env(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | #NAUTILUS_SCRIPT_WINDOW_GEOMETRY: position and size of current window | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | sub geometry { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
geometry: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if ($self->_is_env()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | #: Width, Height, X, Y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | return($1,$2,$3,$4) if $ENV{'NAUTILUS_SCRIPT_WINDOW_GEOMETRY'} =~ /(\d+)x(\d+)\+(\d+)\+(\d+)/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | } else { return(0,0,0,0); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | sub _get_desktop_dir { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | my $self = shift(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_desktop_dir: not called CC=15 SCAR=54.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | # Figure out the user's home directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my @user = getpwuid($>); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $home = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (@user > 7 && -d $user[7]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@user > 7 and -d $user[7]
MC/DC0%0/2
@user > 7 and -d $user[7]
@user > 7
-d $user[7]
Truth table0%0/3
A and B
A= @user > 7B= -d $user[7]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | $home = $user[7]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | # check for XDG paths to home directory | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $xdg_desktop_dir = $ENV{XDG_DESKTOP_DIR} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'XDG_DESKTOP_DIR'} || undef
MC/DC0%0/1
$ENV{'XDG_DESKTOP_DIR'} || undef
$ENV{'XDG_DESKTOP_DIR'}
Truth table0%0/2
A
A= $ENV{'XDG_DESKTOP_DIR'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | if (defined $xdg_desktop_dir && -d $xdg_desktop_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $xdg_desktop_dir and -d $xdg_desktop_dir
MC/DC0%0/2
defined $xdg_desktop_dir and -d $xdg_desktop_dir
defined $xdg_desktop_dir
-d $xdg_desktop_dir
Truth table0%0/3
A and B
A= defined $xdg_desktop_dirB= -d $xdg_desktop_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | return $xdg_desktop_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | ▶ | my $xdg_config_home = $ENV{XDG_CONFIG_HOME} || $home.'/.config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'XDG_CONFIG_HOME'} || $home . '/.config'
MC/DC0%0/1
$ENV{'XDG_CONFIG_HOME'} || $home . '/.config'
$ENV{'XDG_CONFIG_HOME'}
Truth table0%0/2
A
A= $ENV{'XDG_CONFIG_HOME'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | if (-d $xdg_config_home && -f $xdg_config_home.'/user-dirs.dirs') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $xdg_config_home and -f $xdg_config_home . '/user-dirs.dirs'
MC/DC0%0/2
-d $xdg_config_home and -f $xdg_config_home . '/user-dirs.dirs'
-d $xdg_config_home
-f $xdg_config_home . '/user-dirs.dirs'
Truth table0%0/3
A and B
A= -d $xdg_config_homeB= -f $xdg_config_home . '/user-dirs.dirs'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | foreach (`. "${xdg_config_home}/user-dirs.dirs"; env`) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | next unless /=/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my ($var, $value) = split(/=/, $_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $ENV{$var} = $value; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $xdg_desktop_dir = $ENV{XDG_DESKTOP_DIR} || undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$ENV{'XDG_DESKTOP_DIR'} || undef
MC/DC0%0/1
$ENV{'XDG_DESKTOP_DIR'} || undef
$ENV{'XDG_DESKTOP_DIR'}
Truth table0%0/2
A
A= $ENV{'XDG_DESKTOP_DIR'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | if (defined $xdg_desktop_dir && -d $xdg_desktop_dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $xdg_desktop_dir and -d $xdg_desktop_dir
MC/DC0%0/2
defined $xdg_desktop_dir and -d $xdg_desktop_dir
defined $xdg_desktop_dir
-d $xdg_desktop_dir
Truth table0%0/3
A and B
A= defined $xdg_desktop_dirB= -d $xdg_desktop_dir
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return $xdg_desktop_dir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | return $home."/Desktop" if -d $home."/Desktop"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | # finally defaulting to just home | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | return $home; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||