mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
2e25a28a54
Signed-off-by: Elias Naur <mail@eliasnaur.com>
47 lines
1.1 KiB
Go
47 lines
1.1 KiB
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package app
|
|
|
|
import (
|
|
"os"
|
|
"strings"
|
|
|
|
"gioui.org/app/internal/window"
|
|
)
|
|
|
|
// extraArgs contains extra arguments to append to
|
|
// os.Args. The arguments are separated with |.
|
|
// Useful for running programs on mobiles where the
|
|
// command line is not available.
|
|
// Set with the go linker flag -X.
|
|
var extraArgs string
|
|
|
|
func init() {
|
|
if extraArgs != "" {
|
|
args := strings.Split(extraArgs, "|")
|
|
os.Args = append(os.Args, args...)
|
|
}
|
|
}
|
|
|
|
// DataDir returns a path to use for application-specific
|
|
// configuration data.
|
|
// On desktop systems, DataDir use os.UserConfigDir.
|
|
// On iOS NSDocumentDirectory is queried.
|
|
// For Android Context.getFilesDir is used.
|
|
//
|
|
// BUG: DataDir blocks on Android until init functions
|
|
// have completed.
|
|
func DataDir() (string, error) {
|
|
return dataDir()
|
|
}
|
|
|
|
// Main must be called from the program main function. It
|
|
// blocks until there are no more windows active.
|
|
//
|
|
// Calling Main is necessary because some operating systems
|
|
// require control of the main thread of the program for
|
|
// running windows.
|
|
func Main() {
|
|
window.Main()
|
|
}
|