diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-10 11:03:31 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-10 11:03:31 +0900 |
| commit | 2220055e26bff8b426ebf086d09ba242e5180e76 (patch) | |
| tree | 9e66c82b9978bf217f4ff01036a592b7b06e989b /internal/state/print.go | |
| parent | f4c44a9441dea0054f9e4b20c2a3e8e71d9fde8f (diff) | |
state/simple: prefix store path
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/state/print.go')
| -rw-r--r-- | internal/state/print.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/state/print.go b/internal/state/print.go index 5ad7cacd..8de5a59d 100644 --- a/internal/state/print.go +++ b/internal/state/print.go @@ -1,6 +1,7 @@ package state import ( + "errors" "fmt" "os" "path" @@ -9,18 +10,16 @@ import ( "text/tabwriter" "time" - "git.ophivana.moe/cat/fortify/internal" "git.ophivana.moe/cat/fortify/internal/verbose" ) // MustPrintLauncherStateSimpleGlobal prints active launcher states of all simple stores // in an implementation-specific way. -func MustPrintLauncherStateSimpleGlobal(w **tabwriter.Writer) { - sc := internal.GetSC() +func MustPrintLauncherStateSimpleGlobal(w **tabwriter.Writer, runDir string) { now := time.Now().UTC() // read runtime directory to get all UIDs - if dirs, err := os.ReadDir(sc.RunDirPath); err != nil { + if dirs, err := os.ReadDir(path.Join(runDir, "state")); err != nil && !errors.Is(err, os.ErrNotExist) { fmt.Println("cannot read runtime directory:", err) os.Exit(1) } else { @@ -38,7 +37,7 @@ func MustPrintLauncherStateSimpleGlobal(w **tabwriter.Writer) { } // obtain temporary store - s := NewSimple(sc.RunDirPath, e.Name()).(*simpleStore) + s := NewSimple(runDir, e.Name()).(*simpleStore) // print states belonging to this store s.mustPrintLauncherState(w, now) |
