mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 11:37:46 +00:00
Use os.Stat instead of os.ReadDir as that was added in 1.16
This commit is contained in:
committed by
Ron Evans
parent
26625f5a22
commit
d46933abf2
@@ -719,8 +719,8 @@ func flashUF2UsingMSD(volume, tmppath string, options *compileopts.Options) erro
|
||||
var infoPath string
|
||||
switch runtime.GOOS {
|
||||
case "linux", "freebsd":
|
||||
_, err := os.ReadDir("/run/media")
|
||||
if err != nil {
|
||||
fi, err := os.Stat("/run/media")
|
||||
if err != nil || !fi.IsDir() {
|
||||
infoPath = "/media/*/" + volume + "/INFO_UF2.TXT"
|
||||
} else {
|
||||
infoPath = "/run/media/*/" + volume + "/INFO_UF2.TXT"
|
||||
@@ -748,11 +748,11 @@ func flashHexUsingMSD(volume, tmppath string, options *compileopts.Options) erro
|
||||
var destPath string
|
||||
switch runtime.GOOS {
|
||||
case "linux", "freebsd":
|
||||
_, err := os.ReadDir("/run/media")
|
||||
if err != nil {
|
||||
infoPath = "/media/*/" + volume
|
||||
fi, err := os.Stat("/run/media")
|
||||
if err != nil || !fi.IsDir() {
|
||||
destPath = "/media/*/" + volume
|
||||
} else {
|
||||
infoPath = "/run/media/*/" + volume
|
||||
destPath = "/run/media/*/" + volume
|
||||
}
|
||||
case "darwin":
|
||||
destPath = "/Volumes/" + volume
|
||||
|
||||
Reference in New Issue
Block a user