}
if (!-f $dbname) {
require File::Path;
- require File::Basename;
require PublicInbox::Spawn;
- File::Path::mkpath(File::Basename::dirname($dbname));
+ my ($dir) = ($dbname =~ m!(.*?/)[^/]+\z!);
+ File::Path::mkpath($dir);
open my $fh, '+>>', $dbname or die "failed to open $dbname: $!";
PublicInbox::Spawn::nodatacow_fd(fileno($fh));
}
delete $self->{cfg};
return bless {}, 'PublicInbox::Config';
}
- my (undef, $cfg_dir, undef) = File::Spec->splitpath($f);
+ my ($cfg_dir) = ($f =~ m!(.*?/)[^/]+\z!);
-d $cfg_dir or mkpath($cfg_dir) or die "mkpath($cfg_dir): $!\n";
open my $fh, '>>', $f or die "open($f): $!\n";
@st = stat($fh) or die "fstat($f): $!\n";
};
unless (-r $fn) {
require File::Path;
- require File::Basename;
- File::Path::mkpath(File::Basename::dirname($fn));
+ my ($dir) = ($fn =~ m!(.*?/)[^/]+\z!);
+ File::Path::mkpath($dir);
}
# create the DB:
PublicInbox::Over::dbh($self);
use PublicInbox::SearchIdx;
use File::Temp 0.19 (); # ->newdir
use File::Path qw(remove_tree);
-use File::Basename qw(dirname);
use POSIX qw(WNOHANG _exit);
# support testing with dev versions of Xapian which installs
warn
"--reshard=$reshard ignored for v1 $ibx->{inboxdir}\n";
}
- my $dir = dirname($old);
+ my ($dir) = ($old =~ m!(.*?/)[^/]+/*\z!);
same_fs_or_die($dir, $old);
my $v = PublicInbox::Search::SCHEMA_VERSION();
my $wip = File::Temp->newdir("xapian$v-XXXX", DIR => $dir);
my ($tmp, $ft);
local %SIG = %SIG;
if ($opt->{compact}) {
- my $dir = dirname($new);
+ my ($dir) = ($new =~ m!(.*?/)[^/]+/*\z!);
same_fs_or_die($dir, $new);
$ft = File::Temp->newdir("$new.compact-XXXX", DIR => $dir);
setup_signals();
require PublicInbox::Config;
my $pi_config = PublicInbox::Config->default_file;
-require File::Basename;
-my $dir = File::Basename::dirname($pi_config);
+my ($dir) = ($pi_config =~ m!(.*?/)[^/]+\z!);
require File::Path;
File::Path::mkpath($dir); # will croak on fatal errors
use PublicInbox::Config;
use PublicInbox::TestCommon;
use PublicInbox::Admin;
-use File::Basename;
my ($tmpdir, $for_destroy) = tmpdir();
sub quiet_fail {
my ($cmd, $msg) = @_;