fix: Remove hardcoded gastown fallback from log.go (gt-h8k9d)
The crash logging fallback assumed users might have their town at ~/gastown, which only works if the gastown rig is installed. Now only tries ~/gt as the conventional town root. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -264,21 +264,15 @@ func truncateStr(s string, maxLen int) string {
|
|||||||
func runLogCrash(cmd *cobra.Command, args []string) error {
|
func runLogCrash(cmd *cobra.Command, args []string) error {
|
||||||
townRoot, err := workspace.FindFromCwd()
|
townRoot, err := workspace.FindFromCwd()
|
||||||
if err != nil || townRoot == "" {
|
if err != nil || townRoot == "" {
|
||||||
// Try to find town root from common locations
|
// Try to find town root from conventional location
|
||||||
// This is called from tmux hook which may not have proper cwd
|
// This is called from tmux hook which may not have proper cwd
|
||||||
home := os.Getenv("HOME")
|
home := os.Getenv("HOME")
|
||||||
possibleRoots := []string{
|
defaultRoot := home + "/gt"
|
||||||
home + "/gt",
|
if _, statErr := os.Stat(defaultRoot + "/mayor"); statErr == nil {
|
||||||
home + "/gastown",
|
townRoot = defaultRoot
|
||||||
}
|
|
||||||
for _, root := range possibleRoots {
|
|
||||||
if _, statErr := os.Stat(root + "/mayor"); statErr == nil {
|
|
||||||
townRoot = root
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if townRoot == "" {
|
if townRoot == "" {
|
||||||
return fmt.Errorf("cannot find town root")
|
return fmt.Errorf("cannot find town root (tried cwd and ~/gt)")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user