Create absolute directories for ITD to read/write

This commit is contained in:
Elara 2021-12-11 22:13:21 -08:00
parent 873df67d1f
commit 69d1027f01
2 changed files with 10 additions and 2 deletions

View File

@ -22,6 +22,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -49,7 +50,10 @@ var readCmd = &cobra.Command{
} }
path = tmpFile.Name() path = tmpFile.Name()
} else { } 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) client := viper.Get("client").(*api.Client)

View File

@ -22,6 +22,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"os" "os"
"path/filepath"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"github.com/spf13/cobra" "github.com/spf13/cobra"
@ -49,7 +50,10 @@ var writeCmd = &cobra.Command{
} }
path = tmpFile.Name() path = tmpFile.Name()
} else { } 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) client := viper.Get("client").(*api.Client)