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"
|
||||
)
|
||||
|
||||
// FSHelper - Wrapper struct for File System utility commands
|
||||
type FSHelper struct {
|
||||
}
|
||||
|
||||
// NewFSHelper - Returns a new FSHelper
|
||||
func NewFSHelper() *FSHelper {
|
||||
result := &FSHelper{}
|
||||
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 {
|
||||
fi, err := os.Lstat(path)
|
||||
if err != nil {
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
homedir "github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
// SystemHelper - Defines everything related to the system
|
||||
type SystemHelper struct {
|
||||
log *Logger
|
||||
fs *FSHelper
|
||||
@ -22,6 +23,7 @@ type SystemHelper struct {
|
||||
wailsSystemConfig string
|
||||
}
|
||||
|
||||
// NewSystemHelper - Creates a new System Helper
|
||||
func NewSystemHelper() *SystemHelper {
|
||||
result := &SystemHelper{
|
||||
fs: NewFSHelper(),
|
||||
@ -164,17 +166,20 @@ func (s *SystemHelper) Initialise() error {
|
||||
return s.setup()
|
||||
}
|
||||
|
||||
// SystemConfig - Defines system wode configuration data
|
||||
type SystemConfig struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
// NewSystemConfig - Creates a new SystemConfig helper object
|
||||
func NewSystemConfig(filename string) (*SystemConfig, error) {
|
||||
result := &SystemConfig{}
|
||||
err := result.load(filename)
|
||||
return result, err
|
||||
}
|
||||
|
||||
// Save - Saves the system config to the given filename
|
||||
func (sc *SystemConfig) Save(filename string) error {
|
||||
// Convert config to JSON string
|
||||
theJSON, err := json.MarshalIndent(sc, "", " ")
|
||||
|
Loading…
Reference in New Issue
Block a user