helpers: Remove (now) unused GetStaticDir
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 19 Nov 2017 12:47:36 +0000 (13:47 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 19 Nov 2017 13:03:21 +0000 (14:03 +0100)
* In Hugo there is no single static dir
* It was used as a filter in the content dir, which makes no sense since any overlap here is impossible

helpers/path.go
helpers/pathspec.go
helpers/pathspec_test.go
hugolib/site.go

index a0b35e5edcce171821870e7968ecf9c607708a76..57f02da685b48332cbddc025feae4f8f32207de3 100644 (file)
@@ -167,12 +167,6 @@ func (p *PathSpec) GetLayoutDirPath() string {
        return p.AbsPathify(p.layoutDir)
 }
 
-// GetStaticDirPath returns the absolute path to the static file dir
-// for the current Hugo project.
-func (p *PathSpec) GetStaticDirPath() string {
-       return p.AbsPathify(p.StaticDir())
-}
-
 // GetThemeDir gets the root directory of the current theme, if there is one.
 // If there is no theme, returns the empty string.
 func (p *PathSpec) GetThemeDir() string {
@@ -230,16 +224,6 @@ func (p *PathSpec) GetThemesDirPath() string {
        return dir
 }
 
-// MakeStaticPathRelative makes a relative path to the static files directory.
-// It does so by taking either the project's static path or the theme's static
-// path into consideration.
-func (p *PathSpec) MakeStaticPathRelative(inPath string) (string, error) {
-       staticDir := p.GetStaticDirPath()
-       themeStaticDir := p.GetThemesDirPath()
-
-       return makePathRelative(inPath, staticDir, themeStaticDir)
-}
-
 func makePathRelative(inPath string, possibleDirectories ...string) (string, error) {
 
        for _, currentPath := range possibleDirectories {
index 5b7f534fe6a60d75ae1a370acb36f27680a54359..0c9cbea63bb572fdc5430b5b8c5416f9a8e9c8cf 100644 (file)
@@ -133,11 +133,6 @@ func (p *PathSpec) WorkingDir() string {
        return p.workingDir
 }
 
-// StaticDir returns the relative static dir in the current configuration.
-func (p *PathSpec) StaticDir() string {
-       return p.staticDirs[len(p.staticDirs)-1]
-}
-
 // StaticDirs returns the relative static dirs for the current configuration.
 func (p *PathSpec) StaticDirs() []string {
        return p.staticDirs
index c251b6ba88b45499cca446f056686bd48a18ad52..eb1623a5edb807c5141f5091eb074f0913b7e9b2 100644 (file)
@@ -57,6 +57,5 @@ func TestNewPathSpecFromConfig(t *testing.T) {
        require.Equal(t, "thethemes", p.themesDir)
        require.Equal(t, "thelayouts", p.layoutDir)
        require.Equal(t, "thework", p.workingDir)
-       require.Equal(t, "thestatic", p.StaticDir())
        require.Equal(t, "thetheme", p.theme)
 }
index 526ba285e26e65e3d87b628521d5f13dc401b677..936584580f4adcc5d8d80d823ff88d0b1bf0821a 100644 (file)
@@ -977,10 +977,8 @@ func (s *Site) initialize() (err error) {
                return err
        }
 
-       staticDir := s.PathSpec.GetStaticDirPath() + "/"
-
        sp := source.NewSourceSpec(s.Cfg, s.Fs)
-       s.Source = sp.NewFilesystem(s.absContentDir(), staticDir)
+       s.Source = sp.NewFilesystem(s.absContentDir())
 
        return
 }