@@ -140,6 +140,11 @@ sub get_user_config
140
140
}
141
141
}
142
142
143
+ sub get_user_config_showhidden
144
+ {
145
+ return get_user_config(' config_portable_module_filemanager_show_dot_files' ) ne ' false' ;
146
+ }
147
+
143
148
sub kill_previous
144
149
{
145
150
my $pid = tokenize($_ [0]);
@@ -270,6 +275,7 @@ sub test_all_items_query
270
275
sub get_entries_list
271
276
{
272
277
my @entries_list ;
278
+ my $show_dot_files = get_user_config_showhidden();
273
279
if (test_all_items_query()) {
274
280
if ($in {' query' }) {
275
281
@entries_list = exec_search(' list' );
@@ -279,7 +285,7 @@ sub get_entries_list
279
285
wanted => sub {
280
286
my $found = $File::Find::name ;
281
287
$found =~ s / ^\Q $cwd\/\E // g ;
282
- if ($_ ne ' .' && $_ ne ' ..' && $found !~ / \/ / ) {
288
+ if ($_ ne ' .' && $_ ne ' ..' && $found !~ / \/ / && ( $show_dot_files || ( $_ !~ / ^ \. / && $found !~ / \/\. / )) ) {
283
289
push (@entries_list , $found );
284
290
}
285
291
},
@@ -443,6 +449,8 @@ sub exec_search
443
449
my @results ;
444
450
my @excludes ;
445
451
452
+ my $show_dot_files = get_user_config_showhidden();
453
+
446
454
my @results_cached = cache_search($fsid );
447
455
if (@results_cached ) {
448
456
return @results_cached ;
@@ -606,7 +614,9 @@ sub exec_search
606
614
}
607
615
}
608
616
if (!$extra_exclude && (!$exclude || (@excludes && !$excluded ))) {
609
- push (@results , $found );
617
+ if ($show_dot_files || ($_ !~ / ^\. / && $found !~ / \/\. / )) {
618
+ push (@results , $found );
619
+ }
610
620
}
611
621
}
612
622
}
@@ -676,6 +686,8 @@ sub print_content
676
686
$path =~ s / [\/ ]+/ \/ / g ;
677
687
return $path ;
678
688
};
689
+
690
+ my $show_dot_files = get_user_config_showhidden();
679
691
680
692
# In case of search trim the list accordingly
681
693
if ($query ) {
@@ -685,7 +697,8 @@ sub print_content
685
697
print_error(" $text {'theme_xhred_global_error'}: [tt]`$cwd `[/tt]- $! ." );
686
698
exit ;
687
699
}
688
- @list = grep {$_ ne ' .' && $_ ne ' ..' } readdir (DIR);
700
+
701
+ @list = grep {$_ ne ' .' && $_ ne ' ..' && ($show_dot_files || ($_ !~ / ^\. / && $_ !~ / \/\. / ))} readdir (DIR);
689
702
closedir (DIR);
690
703
}
691
704
@@ -1113,6 +1126,8 @@ sub get_tree
1113
1126
my @af = length ($p ) ? ($p ) : @ap ;
1114
1127
my $fu = scalar (@af ) == 1;
1115
1128
1129
+ my $show_dot_files = get_user_config_showhidden();
1130
+
1116
1131
# Check the queried path is allowed in the first place
1117
1132
if (length ($p )) {
1118
1133
return \@r if (grep {$_ =~ / ^\Q $p \E / } @ap );
@@ -1128,7 +1143,9 @@ sub get_tree
1128
1143
my $pp = ($fu && $afic ne ' /' ) ? $afic : undef ;
1129
1144
my $c = $r {$td } =
1130
1145
{ key => html_escape(" $pp /$td " ), title => (defined ($cd ) ? html_escape($cd ) : html_escape($td )), link => $ltd };
1131
- defined $pd ? (push @{ $r {$pd }{' children' } }, $c ) : (push @r , $c );
1146
+ if ($show_dot_files || ($td !~/ ^\. / && $td !~/ \/\. / && $cd !~/ ^\. / && $cd !~/ \/\. / )) {
1147
+ defined $pd ? (push @{ $r {$pd }{' children' } }, $c ) : (push @r , $c );
1148
+ }
1132
1149
};
1133
1150
1134
1151
my $dc = $td =~ tr [/][];
0 commit comments