From f9edec7e4169ecda63ba15762f12e64803b9984d Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 16 Aug 2025 02:32:57 +0900 Subject: [PATCH] hst: merge miscellaneous files These structs were going to be bigger at some point. They turned out not to be. Signed-off-by: Ophestra --- hst/config.go | 1 - hst/{template.go => hst.go} | 18 ++++++++++++++++++ hst/{template_test.go => hst_test.go} | 0 hst/info.go | 6 ------ hst/paths.go | 15 --------------- 5 files changed, 18 insertions(+), 22 deletions(-) rename hst/{template.go => hst.go} (85%) rename hst/{template_test.go => hst_test.go} (100%) delete mode 100644 hst/info.go delete mode 100644 hst/paths.go diff --git a/hst/config.go b/hst/config.go index c694606..34100e4 100644 --- a/hst/config.go +++ b/hst/config.go @@ -1,4 +1,3 @@ -// Package hst exports shared types for invoking hakurei. package hst import ( diff --git a/hst/template.go b/hst/hst.go similarity index 85% rename from hst/template.go rename to hst/hst.go index b06e323..92769a2 100644 --- a/hst/template.go +++ b/hst/hst.go @@ -1,3 +1,4 @@ +// Package hst exports stable shared types for interacting with hakurei. package hst import ( @@ -7,6 +8,23 @@ import ( "hakurei.app/system/dbus" ) +// Paths contains environment-dependent paths used by hakurei. +type Paths struct { + // temporary directory returned by [os.TempDir] (usually `/tmp`) + TempDir *container.Absolute `json:"temp_dir"` + // path to shared directory (usually `/tmp/hakurei.%d`) + SharePath *container.Absolute `json:"share_path"` + // XDG_RUNTIME_DIR value (usually `/run/user/%d`) + RuntimePath *container.Absolute `json:"runtime_path"` + // application runtime directory (usually `/run/user/%d/hakurei`) + RunDirPath *container.Absolute `json:"run_dir_path"` +} + +type Info struct { + User int `json:"user"` + Paths +} + // Template returns a fully populated instance of Config. func Template() *Config { return &Config{ diff --git a/hst/template_test.go b/hst/hst_test.go similarity index 100% rename from hst/template_test.go rename to hst/hst_test.go diff --git a/hst/info.go b/hst/info.go deleted file mode 100644 index e52f746..0000000 --- a/hst/info.go +++ /dev/null @@ -1,6 +0,0 @@ -package hst - -type Info struct { - User int `json:"user"` - Paths -} diff --git a/hst/paths.go b/hst/paths.go deleted file mode 100644 index 7410d7a..0000000 --- a/hst/paths.go +++ /dev/null @@ -1,15 +0,0 @@ -package hst - -import "hakurei.app/container" - -// Paths contains environment-dependent paths used by hakurei. -type Paths struct { - // temporary directory returned by [os.TempDir] (usually `/tmp`) - TempDir *container.Absolute `json:"temp_dir"` - // path to shared directory (usually `/tmp/hakurei.%d`) - SharePath *container.Absolute `json:"share_path"` - // XDG_RUNTIME_DIR value (usually `/run/user/%d`) - RuntimePath *container.Absolute `json:"runtime_path"` - // application runtime directory (usually `/run/user/%d/hakurei`) - RunDirPath *container.Absolute `json:"run_dir_path"` -}