Commit Diff


commit - 1f1dc31d2ab8e43114689286014bbe8643c7cc91
commit + 0c4b2feaac7334c0ef11355e6871b0396579ed07
blob - af1bae59f74297fdd1b70187b06f561e5c000f61
blob + 593d7626fde38c45f380c5ebda7690fe4b17e0cf
--- botnow
+++ botnow
@@ -8,6 +8,7 @@ use IO::Select;
 use OpenBSD::Pledge;
 use OpenBSD::Unveil;
 use File::Copy qw(copy);
+use File::Basename;
 
 # Returns date in YYYYMMDD format
 sub date {
@@ -38,7 +39,7 @@ sub readstr {
 sub writefile {
 	my ($filename, $str) = @_;
 	my $date = date();
-	copy($filename, $filename.date()) or die "Could not make backup of $filename";
+	copy($filename, basename($filename).date()) or die "Could not make backup of $filename";
 	open(my $fh, '>', "$filename") or die "Could not write to $filename";
 	print $fh $str;
 	close $fh;