From 1cd159d0b105d51f10bb9dcf9d815e83c970e97b Mon Sep 17 00:00:00 2001 From: Gulshan Singh Date: Thu, 19 Oct 2023 11:05:41 +0000 Subject: [PATCH] Rename main template ino file --- commands/sketch/new.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/commands/sketch/new.go b/commands/sketch/new.go index 1e318d85039..e91444e2e59 100644 --- a/commands/sketch/new.go +++ b/commands/sketch/new.go @@ -65,6 +65,11 @@ func NewSketch(ctx context.Context, req *rpc.NewSketchRequest) (*rpc.NewSketchRe if err := templateDirPath.CopyDirTo(sketchDirPath); err != nil { return nil, &arduino.CantCreateSketchError{Cause: err} } + + oldMainFilePath := sketchDirPath.Join(templateDirPath.Base() + globals.MainFileValidExtension) + if err := oldMainFilePath.Rename(sketchMainFilePath); err != nil { + return nil, &arduino.CantCreateSketchError{Cause: err} + } } else { if err := sketchDirPath.MkdirAll(); err != nil { return nil, &arduino.CantCreateSketchError{Cause: err}