Skip to content

Commit

Permalink
Merge pull request #15 from dpordomingo/fix-data-dir
Browse files Browse the repository at this point in the history
Set the 'RootFolder' only if it contains 'data' dir
  • Loading branch information
mcuadros authored Apr 20, 2019
2 parents 3bc7a4c + 7ac8755 commit 04fb2a7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ func Init() error {
rf := filepath.Join(
src, "gopkg.in/src-d/go-git-fixtures.v3",
)

if _, err := os.Stat(rf); err == nil {
if _, err := os.Stat(filepath.Join(rf, DataFolder)); err == nil {
RootFolder = rf
return nil
}
Expand All @@ -338,8 +337,11 @@ func Init() error {
// Try the modules local cache
if dir, err := os.Getwd(); err == nil {
if pkg, err := build.Default.Import("gopkg.in/src-d/go-git-fixtures.v3", dir, build.FindOnly); err == nil {
RootFolder = pkg.Dir
return nil
if _, err := os.Stat(filepath.Join(pkg.Dir, DataFolder)); err == nil {
RootFolder = pkg.Dir
return nil
}

}
}

Expand Down

0 comments on commit 04fb2a7

Please sign in to comment.