Skip to content

Commit

Permalink
cmd/golangorg: fix local run directory path
Browse files Browse the repository at this point in the history
FileInfo.Name returns the base name, not the path. Here we need
the path.

This makes "go run ." from cmd/golangorg directory work again.

Change-Id: Iec7533758cf8a696a2696c28107caebf84bbed91
Reviewed-on: https://go-review.googlesource.com/c/website/+/648575
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
cherrymui committed Feb 11, 2025
1 parent d1c4fcc commit 83dcf2e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/golangorg/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func main() {
// which is much faster to access than the simulated file system.
if *contentDir == "" && !runningOnAppEngine {
if fi, err := os.Stat(filepath.Join("..", "..", "_content")); err == nil && fi.IsDir() {
*contentDir = fi.Name()
*contentDir = filepath.Join("..", "..", "_content")
} else if fi, err := os.Stat("_content"); err == nil && fi.IsDir() {
*contentDir = fi.Name()
*contentDir = "_content"
} else {
*contentDir = "" // Fall back to using embedded content.
}
Expand Down

0 comments on commit 83dcf2e

Please sign in to comment.