Input Output component
It is simple package for working with text files.
You should to register package as QML component.
func run() error { iocomponent.Register("fullappname") ui.SetEngine() ui.InitModels() err := ui.SetComponent() if err != nil { return err } ui.Win.Show() ui.Win.Wait() return nil }
"fullappname" is name of your program, for example "by.roker2.mega".
UBports provide 3 writable folders for save and read your program data:
-
/home/phablet/.config/fullappname/
-
/home/phablet/.cache/fullappname/
-
/home/phablet/.local/share/fullappname/
This package use "folderType" for choosing folder. "folderType" is int
- Config is 0
- Cache is 1
- AppData is 2
import GoIOComponent 0.1
IOComponent {
id: io
}
WriteToFile(ft folderType, fileName string, text string)
ReadFromFile(ft folderType, fileName string) string
FileIsExist(ft folderType, fileName string) bool
CreateFile(ft folderType, fileName string)
RemoveFile(ft folderType, fileName string)