forked from joejulian/gio
c080a54038
Android can only run c-shared libraries which means that every Gio program must create its window and event loop from an init function. The same applies to iOS but for a more benign reason: the gio tool builds programs in c-archive mode for iOS and links the binary with a Objective-C driver. Allow Gio programs to run off its main function by linking to and invoking main even from Android libraries and iOS ditto. Signed-off-by: Elias Naur <mail@eliasnaur.com>
26 lines
358 B
Go
26 lines
358 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
// +build android
|
|
|
|
package app
|
|
|
|
import "C"
|
|
import "sync"
|
|
|
|
var (
|
|
dataDirOnce sync.Once
|
|
dataDirChan = make(chan string, 1)
|
|
dataPath string
|
|
)
|
|
|
|
func dataDir() (string, error) {
|
|
dataDirOnce.Do(func() {
|
|
dataPath = <-dataDirChan
|
|
})
|
|
return dataPath, nil
|
|
}
|
|
|
|
func setDataDir(dir string) {
|
|
dataDirChan <- dir
|
|
}
|