summaryrefslogtreecommitdiff
path: root/cmd/hexai-lsp-server/main.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-10 19:35:58 +0200
committerPaul Buetow <paul@buetow.org>2026-03-10 19:35:58 +0200
commit07115c22a74dd5311f70434029791d5346e627c4 (patch)
tree9d1b951d7f8486baf46679163d04fd11049fd034 /cmd/hexai-lsp-server/main.go
parentde5029e6d4a7efffcccfb08d98770b1c1c4f54fe (diff)
task dac9b1e5: avoid LSP startup panic on StateDir failure
Diffstat (limited to 'cmd/hexai-lsp-server/main.go')
-rw-r--r--cmd/hexai-lsp-server/main.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/cmd/hexai-lsp-server/main.go b/cmd/hexai-lsp-server/main.go
index c8cdd8f..e3e458d 100644
--- a/cmd/hexai-lsp-server/main.go
+++ b/cmd/hexai-lsp-server/main.go
@@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
+ "path/filepath"
"strings"
"codeberg.org/snonux/hexai/internal"
@@ -40,13 +41,11 @@ func defaultConfigPath() string {
}
// defaultLogPath returns the default LSP log file path in the state directory.
-// Falls back to /tmp if state directory cannot be determined.
-// defaultLogPath returns the default LSP log file path in the state directory.
-// Panics if state directory cannot be created.
+// Falls back to the system temp directory if the state directory is unavailable.
func defaultLogPath() string {
stateDir, err := appconfig.StateDir()
if err != nil {
- panic(fmt.Sprintf("cannot create state directory: %v", err))
+ return filepath.Join(os.TempDir(), "hexai-lsp-server.log")
}
return fmt.Sprintf("%s/hexai-lsp-server.log", stateDir)
}