Use os.Stat instead of os.ReadDir as that was added in 1.16
Этот коммит содержится в:
родитель
26625f5a22
коммит
d46933abf2
1 изменённых файлов: 6 добавлений и 6 удалений
12
main.go
12
main.go
|
@ -719,8 +719,8 @@ func flashUF2UsingMSD(volume, tmppath string, options *compileopts.Options) erro
|
||||||
var infoPath string
|
var infoPath string
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux", "freebsd":
|
case "linux", "freebsd":
|
||||||
_, err := os.ReadDir("/run/media")
|
fi, err := os.Stat("/run/media")
|
||||||
if err != nil {
|
if err != nil || !fi.IsDir() {
|
||||||
infoPath = "/media/*/" + volume + "/INFO_UF2.TXT"
|
infoPath = "/media/*/" + volume + "/INFO_UF2.TXT"
|
||||||
} else {
|
} else {
|
||||||
infoPath = "/run/media/*/" + volume + "/INFO_UF2.TXT"
|
infoPath = "/run/media/*/" + volume + "/INFO_UF2.TXT"
|
||||||
|
@ -748,11 +748,11 @@ func flashHexUsingMSD(volume, tmppath string, options *compileopts.Options) erro
|
||||||
var destPath string
|
var destPath string
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "linux", "freebsd":
|
case "linux", "freebsd":
|
||||||
_, err := os.ReadDir("/run/media")
|
fi, err := os.Stat("/run/media")
|
||||||
if err != nil {
|
if err != nil || !fi.IsDir() {
|
||||||
infoPath = "/media/*/" + volume
|
destPath = "/media/*/" + volume
|
||||||
} else {
|
} else {
|
||||||
infoPath = "/run/media/*/" + volume
|
destPath = "/run/media/*/" + volume
|
||||||
}
|
}
|
||||||
case "darwin":
|
case "darwin":
|
||||||
destPath = "/Volumes/" + volume
|
destPath = "/Volumes/" + volume
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче