Compare commits

...

1 Commits

Author SHA1 Message Date
Devv
7a719395e6 fix: replace hardcoded Unix path separators with filepath.Join and os.TempDir
- cmd_daemon.go: use filepath.Join for PID/log file paths instead of string concat with "/"
- codex_home.go: use os.TempDir() instead of hardcoded "/tmp" for cross-platform fallback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 18:21:21 +08:00
2 changed files with 4 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ import (
"net/http"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
"time"
@@ -82,11 +83,11 @@ func daemonDirForProfile(profile string) string {
}
func daemonPIDPathForProfile(profile string) string {
return daemonDirForProfile(profile) + "/daemon.pid"
return filepath.Join(daemonDirForProfile(profile), "daemon.pid")
}
func daemonLogPathForProfile(profile string) string {
return daemonDirForProfile(profile) + "/daemon.log"
return filepath.Join(daemonDirForProfile(profile), "daemon.log")
}
// healthPortForProfile returns the health check port for the given profile.

View File

@@ -87,7 +87,7 @@ func resolveSharedCodexHome() string {
}
home, err := os.UserHomeDir()
if err != nil {
return filepath.Join("/tmp", ".codex") // last resort fallback
return filepath.Join(os.TempDir(), ".codex") // last resort fallback
}
return filepath.Join(home, ".codex")
}