fix root for the '.' case

This commit is contained in:
2026-01-26 18:19:05 -05:00
parent 0994a28e77
commit 73b2ad0f11
2 changed files with 12 additions and 2 deletions

View File

@@ -18,7 +18,17 @@ func Start(dir string) {
ui.Error(fmt.Sprintf("failed to change directory to %s", dir), err)
}
ui.Log("running root=%s, port=%d.", filepath.Clean(dir), *config.Port)
root := filepath.Clean(dir)
if root == "." {
if res, err := filepath.Abs(root); err == nil {
root = filepath.Base(res)
} else {
ui.Error("failed to get absolute path", err)
}
}
ui.Log("running root=%s, port=%d.", root, *config.Port)
routes := loadDirs()