Windows-friendly filepath join (hopefully)

This commit is contained in:
sam boyer 2016-08-01 00:28:13 -04:00
Родитель f7840e4ec2
Коммит 0e4001a90a
3 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -126,8 +126,8 @@ func TestProjectManagerInit(t *testing.T) {
}
// Two birds, one stone - make sure the internal ProjectManager vlist cache
// works by asking for the versions again, and do it through smcache to
// ensure its sorting works, as well.
// works (or at least doesn't not work) by asking for the versions again,
// and do it through smcache to ensure its sorting works, as well.
smc := &bridge{
sm: sm,
vlists: make(map[ProjectIdentifier][]Version),

Просмотреть файл

@ -6,7 +6,7 @@ import (
"go/build"
"os"
"os/exec"
"path"
"path/filepath"
"strings"
"sync"
@ -496,7 +496,7 @@ func (r *repo) exportVersionTo(v Version, to string) error {
switch r.r.(type) {
case *vcs.GitRepo:
// Back up original index
idx, bak := path.Join(r.rpath, ".git", "index"), path.Join(r.rpath, ".git", "origindex")
idx, bak := filepath.Join(r.rpath, ".git", "index"), filepath.Join(r.rpath, ".git", "origindex")
err := os.Rename(idx, bak)
if err != nil {
return err

Просмотреть файл

@ -5,7 +5,6 @@ import (
"fmt"
"go/build"
"os"
"path"
"path/filepath"
"strings"
@ -119,7 +118,7 @@ func NewSourceManager(an ProjectAnalyzer, cachedir string, force bool) (*SourceM
return nil, err
}
glpath := path.Join(cachedir, "sm.lock")
glpath := filepath.Join(cachedir, "sm.lock")
_, err = os.Stat(glpath)
if err == nil && !force {
return nil, fmt.Errorf("cache lock file %s exists - another process crashed or is still running?", glpath)
@ -144,7 +143,7 @@ func NewSourceManager(an ProjectAnalyzer, cachedir string, force bool) (*SourceM
// Release lets go of any locks held by the SourceManager.
func (sm *SourceMgr) Release() {
os.Remove(path.Join(sm.cachedir, "sm.lock"))
os.Remove(filepath.Join(sm.cachedir, "sm.lock"))
}
// AnalyzerInfo reports the name and version of the injected ProjectAnalyzer.
@ -330,7 +329,7 @@ func (sm *SourceMgr) getProjectManager(id ProjectIdentifier) (*pmState, error) {
decided:
// Ensure cache dir exists
metadir := path.Join(sm.cachedir, "metadata", string(n))
metadir := filepath.Join(sm.cachedir, "metadata", string(n))
err = os.MkdirAll(metadir, 0777)
if err != nil {
// TODO(sdboyer) be better
@ -338,7 +337,7 @@ decided:
}
pms := &pmState{}
cpath := path.Join(metadir, "cache.json")
cpath := filepath.Join(metadir, "cache.json")
fi, err := os.Stat(cpath)
var dc *projectDataCache
if fi != nil {