2
0
mirror of synced 2025-02-24 15:28:28 +00:00

cmd/gomobile: find a better name for the app if import path is "."

Fixes golang/go#15779.

Change-Id: I762e5ce12b8b76da80af73ddae26dbd46241f134
Reviewed-on: https://go-review.googlesource.com/23307
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Jaana Burcu Dogan 2016-05-20 16:48:44 -07:00
parent 2922272407
commit 7c31375cc4

View File

@ -106,7 +106,17 @@ func goIOSBuild(pkg *build.Package) (map[string]bool, error) {
// TODO(jbd): Fallback to copying if renaming fails. // TODO(jbd): Fallback to copying if renaming fails.
if buildO == "" { if buildO == "" {
buildO = path.Base(pkg.ImportPath) + ".app" n := pkg.ImportPath
if n == "." {
// use cwd name
cwd, err := os.Getwd()
if err != nil {
return nil, fmt.Errorf("cannot create .app; cannot get the current working dir: %v", err)
}
n = cwd
}
n = path.Base(n)
buildO = n + ".app"
} }
if buildX { if buildX {
printcmd("mv %s %s", tmpdir+"/build/Release-iphoneos/main.app", buildO) printcmd("mv %s %s", tmpdir+"/build/Release-iphoneos/main.app", buildO)