mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 14:29:50 +08:00
Added Runtime.FileSystem
This commit is contained in:
parent
205f9476fa
commit
c4a042cb1d
18
runtime.go
18
runtime.go
@ -2,17 +2,19 @@ package wails
|
|||||||
|
|
||||||
// Runtime is the Wails Runtime Interface, given to a user who has defined the WailsInit method
|
// Runtime is the Wails Runtime Interface, given to a user who has defined the WailsInit method
|
||||||
type Runtime struct {
|
type Runtime struct {
|
||||||
Events *RuntimeEvents
|
Events *RuntimeEvents
|
||||||
Log *RuntimeLog
|
Log *RuntimeLog
|
||||||
Dialog *RuntimeDialog
|
Dialog *RuntimeDialog
|
||||||
Window *RuntimeWindow
|
Window *RuntimeWindow
|
||||||
|
FileSystem *RuntimeFileSystem
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRuntime(eventManager *eventManager, renderer Renderer) *Runtime {
|
func newRuntime(eventManager *eventManager, renderer Renderer) *Runtime {
|
||||||
return &Runtime{
|
return &Runtime{
|
||||||
Events: newRuntimeEvents(eventManager),
|
Events: newRuntimeEvents(eventManager),
|
||||||
Log: newRuntimeLog(),
|
Log: newRuntimeLog(),
|
||||||
Dialog: newRuntimeDialog(renderer),
|
Dialog: newRuntimeDialog(renderer),
|
||||||
Window: newRuntimeWindow(renderer),
|
Window: newRuntimeWindow(renderer),
|
||||||
|
FileSystem: newRuntimeFileSystem(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
runtime_filesystem.go
Normal file
16
runtime_filesystem.go
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package wails
|
||||||
|
|
||||||
|
import homedir "github.com/mitchellh/go-homedir"
|
||||||
|
|
||||||
|
// RuntimeFileSystem exposes file system utilities to the runtime
|
||||||
|
type RuntimeFileSystem struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func newRuntimeFileSystem() *RuntimeFileSystem {
|
||||||
|
return &RuntimeFileSystem{}
|
||||||
|
}
|
||||||
|
|
||||||
|
// HomeDir returns the user's home directory
|
||||||
|
func (r *RuntimeFileSystem) HomeDir() (string, error) {
|
||||||
|
return homedir.Dir()
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user