summaryrefslogtreecommitdiffhomepage
path: root/hugolib/paths/paths.go
diff options
context:
space:
mode:
Diffstat (limited to 'hugolib/paths/paths.go')
-rw-r--r--hugolib/paths/paths.go18
1 files changed, 6 insertions, 12 deletions
diff --git a/hugolib/paths/paths.go b/hugolib/paths/paths.go
index 1ab7ae87e..f6e7b1a76 100644
--- a/hugolib/paths/paths.go
+++ b/hugolib/paths/paths.go
@@ -18,6 +18,8 @@ import (
"path/filepath"
"strings"
+ hpaths "github.com/gohugoio/hugo/common/paths"
+
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/langs"
"github.com/gohugoio/hugo/modules"
@@ -51,6 +53,7 @@ type Paths struct {
// pagination path handling
PaginatePath string
+ // TODO1 check usage
PublishDir string
// When in multihost mode, this returns a list of base paths below PublishDir
@@ -123,7 +126,7 @@ func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error) {
languages = langs.Languages{&langs.Language{Lang: "en", Cfg: cfg, ContentDir: contentDir}}
}
- absPublishDir := AbsPathify(workingDir, publishDir)
+ absPublishDir := hpaths.AbsPathify(workingDir, publishDir)
if !strings.HasSuffix(absPublishDir, FilePathSeparator) {
absPublishDir += FilePathSeparator
}
@@ -131,7 +134,7 @@ func New(fs *hugofs.Fs, cfg config.Provider) (*Paths, error) {
if absPublishDir == "//" {
absPublishDir = FilePathSeparator
}
- absResourcesDir := AbsPathify(workingDir, resourceDir)
+ absResourcesDir := hpaths.AbsPathify(workingDir, resourceDir)
if !strings.HasSuffix(absResourcesDir, FilePathSeparator) {
absResourcesDir += FilePathSeparator
}
@@ -254,7 +257,7 @@ func (p *Paths) GetLangSubDir(lang string) string {
// AbsPathify creates an absolute path if given a relative path. If already
// absolute, the path is just cleaned.
func (p *Paths) AbsPathify(inPath string) string {
- return AbsPathify(p.WorkingDir, inPath)
+ return hpaths.AbsPathify(p.WorkingDir, inPath)
}
// RelPathify trims any WorkingDir prefix from the given filename. If
@@ -267,12 +270,3 @@ func (p *Paths) RelPathify(filename string) string {
return strings.TrimPrefix(strings.TrimPrefix(filename, p.WorkingDir), FilePathSeparator)
}
-
-// AbsPathify creates an absolute path if given a working dir and a relative path.
-// If already absolute, the path is just cleaned.
-func AbsPathify(workingDir, inPath string) string {
- if filepath.IsAbs(inPath) {
- return filepath.Clean(inPath)
- }
- return filepath.Join(workingDir, inPath)
-}