refine: check msd paths
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -133,12 +134,29 @@ func flashMSD(msd crosscompile.MSD, app string, verbose bool) error {
|
|||||||
// Find the MSD volume
|
// Find the MSD volume
|
||||||
var mountPoint string
|
var mountPoint string
|
||||||
for _, volumeName := range msd.VolumeName {
|
for _, volumeName := range msd.VolumeName {
|
||||||
// Try common mount points on different platforms
|
// Try platform-specific mount points
|
||||||
candidates := []string{
|
var candidates []string
|
||||||
|
switch runtime.GOOS {
|
||||||
|
case "darwin":
|
||||||
|
candidates = []string{
|
||||||
|
filepath.Join("/Volumes", volumeName),
|
||||||
|
}
|
||||||
|
case "linux":
|
||||||
|
candidates = []string{
|
||||||
|
filepath.Join("/media", os.Getenv("USER"), volumeName),
|
||||||
|
filepath.Join("/mnt", volumeName),
|
||||||
|
}
|
||||||
|
case "windows":
|
||||||
|
candidates = []string{
|
||||||
|
volumeName + ":",
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
candidates = []string{
|
||||||
filepath.Join("/Volumes", volumeName), // macOS
|
filepath.Join("/Volumes", volumeName), // macOS
|
||||||
filepath.Join("/media", os.Getenv("USER"), volumeName), // Linux
|
filepath.Join("/media", os.Getenv("USER"), volumeName), // Linux
|
||||||
filepath.Join("/mnt", volumeName), // Linux alternative
|
filepath.Join("/mnt", volumeName), // Linux alternative
|
||||||
volumeName + ":", // Windows (assuming drive letter)
|
volumeName + ":", // Windows
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, candidate := range candidates {
|
for _, candidate := range candidates {
|
||||||
|
|||||||
Reference in New Issue
Block a user