modules: Allow absolute paths for project imports

Fixes #7910
This commit is contained in:
Bjørn Erik Pedersen
2020-10-30 10:14:08 +01:00
parent 332b65e4cc
commit beabc8d998
2 changed files with 19 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ package modules
import (
"bytes"
"fmt"
"os"
"path/filepath"
"testing"
@@ -157,6 +158,14 @@ project github.com/gohugoio/hugoTestModules1_darwin/modh2_2_2@v1.3.0+vendor
dirname, err = client.createThemeDirname("../../foo", false)
c.Assert(err, qt.Not(qt.IsNil))
absDir := filepath.Join(client.ccfg.WorkingDir, "..", "..")
dirname, err = client.createThemeDirname(absDir, true)
c.Assert(err, qt.IsNil)
c.Assert(dirname, qt.Equals, absDir)
dirname, err = client.createThemeDirname(absDir, false)
fmt.Println(dirname)
c.Assert(err, qt.Not(qt.IsNil))
})
}