From 070d5ea53a0ae9e9eda8c09ec1d16e2f5e4894fb Mon Sep 17 00:00:00 2001 From: sosolyht Date: Tue, 30 May 2023 21:57:54 +0900 Subject: [PATCH] fix: incorrect project path issue --- sitemap/sitemap.go | 3 ++- sitemap/video_sitemap.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sitemap/sitemap.go b/sitemap/sitemap.go index f408b8e..ff73bb8 100644 --- a/sitemap/sitemap.go +++ b/sitemap/sitemap.go @@ -2,6 +2,7 @@ package sitemap import ( "encoding/xml" + "fmt" "io" "log" "net/http" @@ -87,7 +88,7 @@ func (s *sitemap) Path(path string) *sitemap { log.Fatal(err) } - projectRoot := filepath.Join(currentDir, "..", "..") + projectRoot := fmt.Sprintf("%s/%s", filepath.Dir(currentDir), filepath.Base(currentDir)) sitemapsDir := filepath.Join(projectRoot, path) _, err = os.Stat(sitemapsDir) diff --git a/sitemap/video_sitemap.go b/sitemap/video_sitemap.go index a151256..3955c2a 100644 --- a/sitemap/video_sitemap.go +++ b/sitemap/video_sitemap.go @@ -2,6 +2,7 @@ package sitemap import ( "encoding/xml" + "fmt" "log" "os" "path/filepath" @@ -94,7 +95,7 @@ func (v *videoSitemap) Path(path string) *videoSitemap { log.Fatal(err) } - projectRoot := filepath.Join(currentDir, "..", "..") + projectRoot := fmt.Sprintf("%s/%s", filepath.Dir(currentDir), filepath.Base(currentDir)) sitemapsDir := filepath.Join(projectRoot, path) _, err = os.Stat(sitemapsDir)