mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 17:52:29 +08:00
docs: Updated code comments
This commit is contained in:
parent
db550f81cd
commit
04c64c1bea
@ -10,15 +10,17 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// FSHelper - Wrapper struct for File System utility commands
|
||||||
type FSHelper struct {
|
type FSHelper struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewFSHelper - Returns a new FSHelper
|
||||||
func NewFSHelper() *FSHelper {
|
func NewFSHelper() *FSHelper {
|
||||||
result := &FSHelper{}
|
result := &FSHelper{}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if the given path resolves to a directory on the filesystem
|
// DirExists - Returns true if the given path resolves to a directory on the filesystem
|
||||||
func (fs *FSHelper) DirExists(path string) bool {
|
func (fs *FSHelper) DirExists(path string) bool {
|
||||||
fi, err := os.Lstat(path)
|
fi, err := os.Lstat(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
homedir "github.com/mitchellh/go-homedir"
|
homedir "github.com/mitchellh/go-homedir"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// SystemHelper - Defines everything related to the system
|
||||||
type SystemHelper struct {
|
type SystemHelper struct {
|
||||||
log *Logger
|
log *Logger
|
||||||
fs *FSHelper
|
fs *FSHelper
|
||||||
@ -22,6 +23,7 @@ type SystemHelper struct {
|
|||||||
wailsSystemConfig string
|
wailsSystemConfig string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSystemHelper - Creates a new System Helper
|
||||||
func NewSystemHelper() *SystemHelper {
|
func NewSystemHelper() *SystemHelper {
|
||||||
result := &SystemHelper{
|
result := &SystemHelper{
|
||||||
fs: NewFSHelper(),
|
fs: NewFSHelper(),
|
||||||
@ -164,17 +166,20 @@ func (s *SystemHelper) Initialise() error {
|
|||||||
return s.setup()
|
return s.setup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SystemConfig - Defines system wode configuration data
|
||||||
type SystemConfig struct {
|
type SystemConfig struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSystemConfig - Creates a new SystemConfig helper object
|
||||||
func NewSystemConfig(filename string) (*SystemConfig, error) {
|
func NewSystemConfig(filename string) (*SystemConfig, error) {
|
||||||
result := &SystemConfig{}
|
result := &SystemConfig{}
|
||||||
err := result.load(filename)
|
err := result.load(filename)
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Save - Saves the system config to the given filename
|
||||||
func (sc *SystemConfig) Save(filename string) error {
|
func (sc *SystemConfig) Save(filename string) error {
|
||||||
// Convert config to JSON string
|
// Convert config to JSON string
|
||||||
theJSON, err := json.MarshalIndent(sc, "", " ")
|
theJSON, err := json.MarshalIndent(sc, "", " ")
|
||||||
|
Loading…
Reference in New Issue
Block a user