Documentation
¶
Overview ¶
Package pack writes what packaging needs without the platform's tools: icons (.icns, .ico), Info.plist, the NSIS installer script. Used by the macOS engine at runtime (the engine copy's icon) and by the lightron command.
Index ¶
- func DecodePNG(b []byte) (image.Image, error)
- func ICNS(src image.Image) []byte
- func ICO(src image.Image, sizes []int, bmp bool) []byte
- func NSISScript(d NSIS) (string, error)
- func PNG(img image.Image) []byte
- func Plist(values map[string]any) []byte
- func Scale(src image.Image, n int) *image.NRGBA
- func WindowsResources(w io.Writer, arch string, icon image.Image, name, ver, company string) error
- func Zip(dst, dir string) error
- type NSIS
- type NSISDir
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ICNS ¶
ICNS writes a macOS .icns from a square image: PNG entries at the sizes Finder, the Dock and Retina screens ask for (macOS 10.7 and later read PNG entries), so no iconutil is needed.
func ICO ¶
ICO writes a Windows .ico from a square image at the given sizes (≤256). PNG entries (Windows Vista and later), or classic 32-bit bitmaps when bmp: NSIS's installer icon needs those (makensis aborts on PNG entries).
func NSISScript ¶
NSISScript is the Windows installer (makensis): per user, no admin rights, into %LOCALAPPDATA%\Programs\<Name>; Start menu and desktop shortcuts; an entry in Installed apps; it starts the app when done. An update runs it with /S (update.Install): it installs over the installed one, then starts it, showing its progress window all the same. It waits up to five seconds for a running app to quit before killing it (an older updater quits after starting it).
func Scale ¶
Scale draws src at n×n, each target pixel the average of the source pixels it covers (alpha-weighted, so transparent corners don't darken the edges). Downscaling only, which is what icons need.
func WindowsResources ¶
WindowsResources writes a .syso the Go linker puts into the .exe (it picks up *.syso of the package it builds): the icon Explorer and the taskbar show, a manifest (per-monitor v2 DPI, common controls v6), version information.
Types ¶
type NSIS ¶
type NSIS struct {
Name, Version, Publisher string
Exe string // the app's .exe, installed as is
Files []string // absolute paths of the files to install next to the exe (the exe included)
Dirs []NSISDir
Include string // an NSIS script to !include; its macro preInstall runs before the files are copied
Out string // the installer's path
Icon string // a bitmap .ico for the installer itself
ShortcutIcon string // the .ico installed for shortcuts (one of Files' names), "" = the exe's
RegKey string // the uninstall registry key's name
Protocols []string // URL schemes: registered for the current user (the app also does at each start)
}
NSIS is what the installer script needs.