Skip to content

Commit 3dcbb73

Browse files
committed
replace "path" with "filepath" (OS agnostic)
the path library has some problems with Win, using filepath we get the expected results on all platform
1 parent fea601a commit 3dcbb73

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

conn.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"errors"
1414
"io/ioutil"
1515
"net/http"
16-
"path"
16+
"path/filepath"
1717

1818
log "github.com/Sirupsen/logrus"
1919
"github.com/arduino/arduino-create-agent/utilities"
@@ -104,21 +104,21 @@ func uploadHandler(c *gin.Context) {
104104

105105
buffer := bytes.NewBuffer(data.Hex)
106106

107-
filepath, err := utilities.SaveFileonTempDir(data.Filename, buffer)
107+
filePath, err := utilities.SaveFileonTempDir(data.Filename, buffer)
108108
if err != nil {
109109
c.String(http.StatusBadRequest, err.Error())
110110
return
111111
}
112112

113113
for _, extraFile := range data.ExtraFiles {
114-
ioutil.WriteFile(path.Join(path.Dir(filepath), extraFile.Filename), extraFile.Hex, 0644)
114+
ioutil.WriteFile(filepath.Join(filepath.Dir(filePath), extraFile.Filename), extraFile.Hex, 0644)
115115
}
116116

117117
if data.Rewrite != "" {
118118
data.Board = data.Rewrite
119119
}
120120

121-
go spProgramRW(data.Port, data.Board, filepath, data.Commandline, data.Extra)
121+
go spProgramRW(data.Port, data.Board, filePath, data.Commandline, data.Extra)
122122

123123
c.String(http.StatusAccepted, "")
124124
}

0 commit comments

Comments
 (0)