Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add .ino suffix trim
  • Loading branch information
Roberto Sora committed Sep 11, 2019
commit 24c337fe0f2f6b3ac252f1db3841d65940ba30d0
5 changes: 4 additions & 1 deletion cli/sketch/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"io/ioutil"
"os"
"path/filepath"
"strings"

"github.com/arduino/arduino-cli/cli/errorcodes"
"github.com/arduino/arduino-cli/cli/feedback"
Expand Down Expand Up @@ -48,7 +49,9 @@ void loop() {
`)

func runNewCommand(cmd *cobra.Command, args []string) {
sketchDir, err := filepath.Abs(args[0])
// Trim to avoid issues if user creates a sketch adding the .ino extesion to the name
trimmedSketchName := strings.TrimSuffix(args[0], ".ino")
sketchDir, err := filepath.Abs(trimmedSketchName)
if err != nil {
feedback.Errorf("Error creating sketch: %v", err)
os.Exit(errorcodes.ErrGeneric)
Expand Down