summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-13 08:23:01 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-10-13 13:07:59 +0200
commitadf59e8c6cdaf050ef9cf09301111e7429ec0c37 (patch)
treef3b4f2e09b81417bf9bc8ec6168bf3404da974b0
parent242903aa810797102b14e27dda988fff7ab833cc (diff)
Client + Config + FSM: Simplify file names
-rw-r--r--client.go4
-rw-r--r--fsm.go3
-rw-r--r--internal/config/config.go6
-rw-r--r--internal/fsm/fsm.go4
4 files changed, 7 insertions, 10 deletions
diff --git a/client.go b/client.go
index 6aa9a3a..ffa8802 100644
--- a/client.go
+++ b/client.go
@@ -90,11 +90,11 @@ func (client *Client) Register(
}
// Initialize the FSM
- client.FSM = newFSM(name, stateCallback, directory, debug)
+ client.FSM = newFSM(stateCallback, directory, debug)
client.Debug = debug
// Initialize the Config
- client.Config.Init(name, directory)
+ client.Config.Init(directory, "state")
// Try to load the previous configuration
if client.Config.Load(&client) != nil {
diff --git a/fsm.go b/fsm.go
index ae5bfdc..25d3e79 100644
--- a/fsm.go
+++ b/fsm.go
@@ -95,7 +95,6 @@ func GetStateName(s FSMStateID) string {
}
func newFSM(
- name string,
callback func(FSMStateID, FSMStateID, interface{}),
directory string,
debug bool,
@@ -201,7 +200,7 @@ func newFSM(
},
}
returnedFSM := fsm.FSM{}
- returnedFSM.Init(name, STATE_DEREGISTERED, states, callback, directory, GetStateName, debug)
+ returnedFSM.Init(STATE_DEREGISTERED, states, callback, directory, GetStateName, debug)
return returnedFSM
}
diff --git a/internal/config/config.go b/internal/config/config.go
index 0965998..ec9afa2 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -11,13 +11,13 @@ import (
)
type Config struct {
- Name string
Directory string
+ Name string
}
-func (config *Config) Init(name string, directory string) {
- config.Name = name
+func (config *Config) Init(directory string, name string) {
config.Directory = directory
+ config.Name = name
}
func (config *Config) GetFilename() string {
diff --git a/internal/fsm/fsm.go b/internal/fsm/fsm.go
index 4fc647e..d5957b0 100644
--- a/internal/fsm/fsm.go
+++ b/internal/fsm/fsm.go
@@ -54,7 +54,6 @@ type FSM struct {
}
func (fsm *FSM) Init(
- name string,
current FSMStateID,
states map[FSMStateID]FSMState,
callback func(FSMStateID, FSMStateID, interface{}),
@@ -64,7 +63,6 @@ func (fsm *FSM) Init(
) {
fsm.States = states
fsm.Current = current
- fsm.Name = name
fsm.StateCallback = callback
fsm.Directory = directory
fsm.GetName = nameGen
@@ -86,7 +84,7 @@ func (fsm *FSM) HasTransition(check FSMStateID) bool {
}
func (fsm *FSM) getGraphFilename(extension string) string {
- debugPath := path.Join(fsm.Directory, fsm.Name)
+ debugPath := path.Join(fsm.Directory, "graph")
return fmt.Sprintf("%s%s", debugPath, extension)
}