mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-28 08:51:01 +02:00
fix FileImporter not work on windows
This commit is contained in:
parent
c17729a921
commit
b835910677
@ -20,7 +20,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"unsafe"
|
||||
|
||||
"github.com/google/go-jsonnet/ast"
|
||||
@ -232,10 +232,10 @@ func (importer *FileImporter) tryPath(dir, importedPath string) (found bool, con
|
||||
importer.fsCache = make(map[string]*fsCacheEntry)
|
||||
}
|
||||
var absPath string
|
||||
if path.IsAbs(importedPath) {
|
||||
if filepath.IsAbs(importedPath) {
|
||||
absPath = importedPath
|
||||
} else {
|
||||
absPath = path.Join(dir, importedPath)
|
||||
absPath = filepath.Join(dir, importedPath)
|
||||
}
|
||||
var entry *fsCacheEntry
|
||||
if cacheEntry, isCached := importer.fsCache[absPath]; isCached {
|
||||
@ -268,7 +268,7 @@ func (importer *FileImporter) Import(importedFrom, importedPath string) (content
|
||||
// in the importer.
|
||||
// We need to relativize the paths in the error formatter, so that the stack traces
|
||||
// don't have ugly absolute paths (less readable and messy with golden tests).
|
||||
dir, _ := path.Split(importedFrom)
|
||||
dir, _ := filepath.Split(importedFrom)
|
||||
found, content, foundHere, err := importer.tryPath(dir, importedPath)
|
||||
if err != nil {
|
||||
return Contents{}, "", err
|
||||
|
Loading…
x
Reference in New Issue
Block a user