mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
cmd/gogio: add -icon flag for specifying the app icon file
Before users were limited to only use a appicon.png in the root directory. Now the user is free to use any png anywhere on the system with the help of the -icon flag. Signed-off-by: Axel Paulander <axel.paulander@gmail.com>
This commit is contained in:
committed by
Elias Naur
parent
17b5898dd3
commit
edef73f580
@@ -350,7 +350,10 @@ func exeAndroid(tmpDir string, tools *androidTools, bi *buildInfo, extraJars, pe
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
icon := filepath.Join(bi.dir, "appicon.png")
|
icon := *iconPath
|
||||||
|
if icon == "" {
|
||||||
|
icon = filepath.Join(bi.dir, "appicon.png")
|
||||||
|
}
|
||||||
iconSnip := ""
|
iconSnip := ""
|
||||||
if _, err := os.Stat(icon); err == nil {
|
if _, err := os.Stat(icon); err == nil {
|
||||||
err := buildIcons(resDir, icon, []iconVariant{
|
err := buildIcons(resDir, icon, []iconVariant{
|
||||||
|
|||||||
+4
-3
@@ -15,9 +15,6 @@ programs for platforms where additional metadata or support files are required.
|
|||||||
The package argument specifies an import path or a single Go source file to
|
The package argument specifies an import path or a single Go source file to
|
||||||
package. Any run arguments are appended to os.Args at runtime.
|
package. Any run arguments are appended to os.Args at runtime.
|
||||||
|
|
||||||
If the package contains an appicon.png file, it is used as the app icon on
|
|
||||||
supported platforms.
|
|
||||||
|
|
||||||
Compiled Java class files from jar files in the package directory are
|
Compiled Java class files from jar files in the package directory are
|
||||||
included in Android builds.
|
included in Android builds.
|
||||||
|
|
||||||
@@ -42,6 +39,10 @@ will output an app directory suitable for a simulator.
|
|||||||
The other buildmode is archive, which will output an .aar library for Android
|
The other buildmode is archive, which will output an .aar library for Android
|
||||||
or a .framework for iOS and tvOS.
|
or a .framework for iOS and tvOS.
|
||||||
|
|
||||||
|
The -icon flag specifies a path to a PNG image to use as app icon on iOS and Android.
|
||||||
|
If left unspecified, the appicon.png file from the main package is used
|
||||||
|
(if it exists).
|
||||||
|
|
||||||
The -appid flag specifies the package name for Android or the bundle id for
|
The -appid flag specifies the package name for Android or the bundle id for
|
||||||
iOS and tvOS. A bundle id must be provisioned through Xcode before the gogio
|
iOS and tvOS. A bundle id must be provisioned through Xcode before the gogio
|
||||||
tool can use it.
|
tool can use it.
|
||||||
|
|||||||
@@ -222,7 +222,10 @@ int main(int argc, char * argv[]) {
|
|||||||
if err := ioutil.WriteFile(plistFile, []byte(infoPlist), 0660); err != nil {
|
if err := ioutil.WriteFile(plistFile, []byte(infoPlist), 0660); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
icon := filepath.Join(bi.dir, "appicon.png")
|
icon := *iconPath
|
||||||
|
if icon == "" {
|
||||||
|
icon = filepath.Join(bi.dir, "appicon.png")
|
||||||
|
}
|
||||||
if _, err := os.Stat(icon); err == nil {
|
if _, err := os.Stat(icon); err == nil {
|
||||||
assetPlist, err := iosIcons(bi, tmpDir, app, icon)
|
assetPlist, err := iosIcons(bi, tmpDir, app, icon)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ var (
|
|||||||
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
|
linkMode = flag.String("linkmode", "", "set the -linkmode flag of the go tool")
|
||||||
extraLdflags = flag.String("ldflags", "", "extra flags to the Go linker")
|
extraLdflags = flag.String("ldflags", "", "extra flags to the Go linker")
|
||||||
extraTags = flag.String("tags", "", "extra tags to the Go tool")
|
extraTags = flag.String("tags", "", "extra tags to the Go tool")
|
||||||
|
iconPath = flag.String("icon", "", "Specify an icon for iOS and Android")
|
||||||
)
|
)
|
||||||
|
|
||||||
type buildInfo struct {
|
type buildInfo struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user