Skip to content

Commit

Permalink
fix imageToFind reference on Windows OS (#129)
Browse files Browse the repository at this point in the history
* added a check for the current OS to provide proper imageToFind string
  • Loading branch information
shamanec authored Apr 21, 2022
1 parent 08844e9 commit 7878cad
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ios/imagemounter/imagedownloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package imagemounter

import (
"fmt"
"github.com/Masterminds/semver"
"github.com/danielpaulus/go-ios/ios"
"github.com/danielpaulus/go-ios/ios/zipconduit"
log "github.com/sirupsen/logrus"
"io"
"net/http"
"os"
"path"
"path/filepath"
"runtime"
"strings"

"github.com/Masterminds/semver"
"github.com/danielpaulus/go-ios/ios"
"github.com/danielpaulus/go-ios/ios/zipconduit"
log "github.com/sirupsen/logrus"
)

const repo = "https://github.com/haikieu/xcode-developer-disk-image-all-platforms/raw/master/DiskImages/iPhoneOS.platform/DeviceSupport/%s.zip"
Expand Down Expand Up @@ -101,7 +103,13 @@ func DownloadImageFor(device ios.DeviceEntry, baseDir string) (string, error) {
}

func findImage(dir string, version string) (string, error) {
imageToFind := fmt.Sprintf("%s/%s", version, developerDiskImageDmg)
var imageToFind string
switch runtime.GOOS {
case "windows":
imageToFind = fmt.Sprintf("%s\\%s", version, developerDiskImageDmg)
default:
imageToFind = fmt.Sprintf("%s/%s", version, developerDiskImageDmg)
}
var imageWeFound string
err := filepath.Walk(dir,
func(path string, info os.FileInfo, err error) error {
Expand Down

0 comments on commit 7878cad

Please sign in to comment.