about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-09-02 21:29:11 +0530
committerAndinus <andinus@nand.sh>2020-09-02 21:29:11 +0530
commit078ee3b7156760a266d2355e9f63a595208e02f4 (patch)
treeda9cfe07b6d0f472f4f9d7abe194eff9499dbeef
parent88d6d56531d37a9b8e12bab9d64842297a38b73d (diff)
downloadleo-078ee3b7156760a266d2355e9f63a595208e02f4.tar.gz
Fix logical error
There are still issues with this, for example the user can't pass
``documents/text.txt'' or anything in sub-directory.
-rwxr-xr-xleo.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/leo.pl b/leo.pl
index c2cbff5..054b9a1 100755
--- a/leo.pl
+++ b/leo.pl
@@ -49,11 +49,13 @@ foreach my $arg ( @ARGV ) {
         backup("$backup_dir/${arg}.tar", $profile{$arg}->@*);
 
         $options{encrypt} = $tmp if $prof eq "journal";
-    } elsif ( -e $ENV{HOME}/$arg ) {
+    } elsif ( -e $arg ) {
         # If the file/directory exist then create a new profile & run
         # backup.
         say "++++++++********++++++++";
-        backup("$backup_dir/${arg}.tar", $arg);
+        backup("$backup_dir/${arg}.tar",
+               # backup() is expecting path relative to $ENV{HOME}.
+               path($arg)->relative($ENV{HOME}));
     } else {
         warn "[WARN] leo: no such profile :: `$arg' \n";
     }