From e7bf2657769ce5e738738bd9042f467857b37590 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Mon, 18 Jul 2016 09:25:19 +0200 Subject: [PATCH] Better backup --- install.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/install.pl b/install.pl index c6bbaab..8209c99 100755 --- a/install.pl +++ b/install.pl @@ -3,10 +3,13 @@ use 5.018; use autodie; use Cwd 'realpath'; -use File::Copy 'move'; say "Backuping your original vimrc"; -move "$ENV{'HOME'}/.vimrc", "$ENV{'HOME'}/.vimrc.old"; +eval { + rename "$ENV{'HOME'}/.vimrc", "$ENV{'HOME'}/.vimrc.old"; +} or do { + say "No file to backup"; +}; say "Writing your new config"; open my $vimrc, '>', "$ENV{'HOME'}/.vimrc";