From 65ba1f6ac13118369bdb280a2a0915decb7a6796 Mon Sep 17 00:00:00 2001 From: Jan Date: Wed, 9 Feb 2022 20:35:29 +0100 Subject: [PATCH] Make a copy of config before overriding it --- internal/config.go | 2 +- internal/utils.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/config.go b/internal/config.go index 5909df8..f50aa5b 100644 --- a/internal/config.go +++ b/internal/config.go @@ -259,7 +259,7 @@ func (c *Config) SaveConfig() error { if err := CopyFile(file, file+".old"); err != nil { return err } - colors.Secondary.Println("Saved a backup copy of your file next the the original.") + colors.Secondary.Println("Saved a backup copy of your file next to the original.") viper.Set("backends", c.Backends) viper.Set("locations", c.Locations) diff --git a/internal/utils.go b/internal/utils.go index 1bc2b36..302df2e 100644 --- a/internal/utils.go +++ b/internal/utils.go @@ -60,13 +60,13 @@ func ExecuteResticCommand(options ExecuteOptions, args ...string) (string, error } func CopyFile(from, to string) error { - original, err := os.Open("original.txt") + original, err := os.Open(from) if err != nil { return nil } defer original.Close() - new, err := os.Create("new.txt") + new, err := os.Create(to) if err != nil { return nil }