From 38eda50537decb61cb3cd5d73544e8e8f88ade1b Mon Sep 17 00:00:00 2001 From: Elara Musayelyan Date: Sat, 11 Dec 2021 22:13:21 -0800 Subject: [PATCH] Create absolute directories for ITD to read/write --- cmd/itctl/filesystem/read.go | 6 +++++- cmd/itctl/filesystem/write.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/itctl/filesystem/read.go b/cmd/itctl/filesystem/read.go index 6abab1c..8d269dc 100644 --- a/cmd/itctl/filesystem/read.go +++ b/cmd/itctl/filesystem/read.go @@ -22,6 +22,7 @@ import ( "io" "io/ioutil" "os" + "path/filepath" "github.com/rs/zerolog/log" "github.com/spf13/cobra" @@ -49,7 +50,10 @@ var readCmd = &cobra.Command{ } path = tmpFile.Name() } else { - path = args[1] + path, err = filepath.Abs(args[1]) + if err != nil { + log.Fatal().Err(err).Msg("Error making absolute directory") + } } client := viper.Get("client").(*api.Client) diff --git a/cmd/itctl/filesystem/write.go b/cmd/itctl/filesystem/write.go index 3a64128..112a928 100644 --- a/cmd/itctl/filesystem/write.go +++ b/cmd/itctl/filesystem/write.go @@ -22,6 +22,7 @@ import ( "io" "io/ioutil" "os" + "path/filepath" "github.com/rs/zerolog/log" "github.com/spf13/cobra" @@ -49,7 +50,10 @@ var writeCmd = &cobra.Command{ } path = tmpFile.Name() } else { - path = args[0] + path, err = filepath.Abs(args[0]) + if err != nil { + log.Fatal().Err(err).Msg("Error making absolute directory") + } } client := viper.Get("client").(*api.Client)