Skip to content

Commit

Permalink
Fix FullFilePath
Browse files Browse the repository at this point in the history
Fixes #732
  • Loading branch information
bep committed May 31, 2015
1 parent 3cee9b7 commit be0903c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hugolib/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ func (p *Page) Convert() error {
}

func (p *Page) FullFilePath() string {
return filepath.Join(p.Source.Dir(), p.Source.Path())
return filepath.Join(p.Dir(), p.LogicalName())
}

func (p *Page) TargetPath() (outfile string) {
Expand Down
13 changes: 9 additions & 4 deletions hugolib/page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ func TestSliceToLower(t *testing.T) {
}
}

func TestTargetPath(t *testing.T) {
func TestPagePaths(t *testing.T) {
viper.Reset()
defer viper.Reset()

Expand Down Expand Up @@ -700,10 +700,15 @@ func TestTargetPath(t *testing.T) {
p.Node.Site.Permalinks = site_permalinks_setting
}

expected := filepath.FromSlash(test.expected)
expectedTargetPath := filepath.FromSlash(test.expected)
expectedFullFilePath := filepath.FromSlash(test.path)

if p.TargetPath() != expected {
t.Errorf("%s => TargetPath expected: '%s', got: '%s'", test.content, expected, p.TargetPath())
if p.TargetPath() != expectedTargetPath {
t.Errorf("%s => TargetPath expected: '%s', got: '%s'", test.content, expectedTargetPath, p.TargetPath())
}

if p.FullFilePath() != expectedFullFilePath {
t.Errorf("%s => FullFilePath expected: '%s', got: '%s'", test.content, expectedFullFilePath, p.FullFilePath())
}
}
}
Expand Down

0 comments on commit be0903c

Please sign in to comment.