9p: make t/idx a live synthetic file like sk/idx
Add explicit idx check in pathType() before the os.Stat fallback, add idx entry to /t directory listing with mode 0444, and set /t/idx stat mode to 0444. The read handler already generated live content from tool headers — only the routing was broken. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
acaaef9971
commit
61c1b65c83
|
|
@ -309,6 +309,9 @@ func (s *Server) pathType(path string) string {
|
|||
return "file"
|
||||
}
|
||||
case len(parts) == 2 && parts[0] == "t":
|
||||
if parts[1] == "idx" {
|
||||
return "file"
|
||||
}
|
||||
if _, err := os.Stat(execute.ToolsPath() + "/" + parts[1]); err == nil {
|
||||
return "file"
|
||||
}
|
||||
|
|
@ -1493,6 +1496,7 @@ func (s *Server) readDir(path string, offset uint64, count uint32) []byte {
|
|||
dirs = append(dirs, makeDir(name, "/sk/"+name, false, 0666))
|
||||
}
|
||||
} else if path == "/t" {
|
||||
dirs = append(dirs, makeDir("idx", "/t/idx", false, 0444))
|
||||
entries, _ := os.ReadDir(execute.ToolsPath())
|
||||
for _, e := range entries {
|
||||
if !e.IsDir() {
|
||||
|
|
@ -1615,6 +1619,8 @@ func (s *Server) makeStat(path string) plan9.Dir {
|
|||
mode = 0444
|
||||
} else if strings.HasPrefix(path, "/sk/") {
|
||||
mode = 0666
|
||||
} else if path == "/t/idx" {
|
||||
mode = 0444
|
||||
} else if strings.HasPrefix(path, "/t/") {
|
||||
mode = 0777
|
||||
} else {
|
||||
|
|
|
|||
Reference in New Issue