cmd/gomobile: follow the symlink if assets is a symlink

Fixes golang/go#12713.

Change-Id: Ie63a48b2ab3f39d6481fab702e00c762587501b2
Reviewed-on: https://go-review.googlesource.com/14824
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Burcu Dogan 2015-09-22 11:26:15 -07:00
parent 5291eb5e09
commit 18875a7b5b
2 changed files with 10 additions and 1 deletions

View File

@ -179,6 +179,11 @@ func goAndroidBuild(pkg *build.Package) (map[string]bool, error) {
assetsDirExists = fi.IsDir()
}
if assetsDirExists {
// if assets is a symlink, follow the symlink.
assetsDir, err = filepath.EvalSymlinks(assetsDir)
if err != nil {
return nil, err
}
err = filepath.Walk(assetsDir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err

View File

@ -140,7 +140,11 @@ func iosCopyAssets(pkg *build.Package, xcodeProjDir string) error {
// skip walking through to deep copy.
return nil
}
// if assets is a symlink, follow the symlink.
srcAssets, err = filepath.EvalSymlinks(srcAssets)
if err != nil {
return err
}
return filepath.Walk(srcAssets, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err