Skip to content

Commit

Permalink
Merge branch 'hotfix/v1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryG13 committed Jun 15, 2020
2 parents 6bd6116 + 4a93ea8 commit 2bc125a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cmd/airtable-convertor/lib/interation.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package lib
import (
"bufio"
"fmt"
"log"
"os"
"path/filepath"
"runtime"
"strings"
)

Expand All @@ -30,9 +32,21 @@ func (i *Interaction) AskForInput() string {
fmt.Println("Enter the path to file:")

reader := bufio.NewReader(i.Input)
input, _ := reader.ReadString('\n')
input, err := reader.ReadString('\n')

return filepath.Join(cwd, strings.ReplaceAll(input, "\n", ""))
if err != nil {
log.Fatal(err)
}

var newInput string

if runtime.GOOS == "windows" {
newInput = strings.ReplaceAll(input, "\r\n", "")
} else {
newInput = strings.ReplaceAll(input, "\n", "")
}

return filepath.Join(cwd, newInput)
}

// Notify is a commun func to log some actions taken by the script
Expand Down

0 comments on commit 2bc125a

Please sign in to comment.