Skip to content
Snippets Groups Projects
Commit 5b0c7bdd authored by Bensong Liu's avatar Bensong Liu
Browse files

bug fix

parent 987798a0
No related branches found
No related tags found
No related merge requests found
......@@ -87,3 +87,6 @@ dotnet build
3. Parallelize `openxt sync` with multiple fake environment.
4. possible coreXT design issue: If `myProject/subproject1` requires pkgA:net472,
and `myProject/subproject2` requires pkgA:net451. And pkgA:1.0.1 only provides net451,
and pkgA:1.0.2 only provides net472, it booms.
......@@ -55,7 +55,7 @@ func SyncPackages(nugetConfigPath, localRepoPath string, allDeps []dependencyIte
}
}
func GetPackagePathFromName(localRepoPath, pkgName string) (pkgPath string, err error) {
func GetPackagePathFromName(localRepoPath, pkgName, targetNetVer string) (pkgPath string, err error) {
guessBase := localRepoPath + string(os.PathSeparator) + strings.ToLower(pkgName)
files, err := ioutil.ReadDir(guessBase + string(os.PathSeparator))
if err != nil {
......@@ -64,7 +64,7 @@ func GetPackagePathFromName(localRepoPath, pkgName string) (pkgPath string, err
maxVersion := ""
for _, f := range files {
if f.IsDir() {
if f.IsDir() && pathIsDir(f.Name() + string(os.PathSeparator) + "lib" + string(os.PathSeparator) + targetNetVer) {
if version.CompareSimple(f.Name(), maxVersion) >= 0 {
maxVersion = f.Name()
}
......@@ -74,7 +74,7 @@ func GetPackagePathFromName(localRepoPath, pkgName string) (pkgPath string, err
if maxVersion != "" {
return guessBase + string(os.PathSeparator) + maxVersion, nil
} else {
return "", errors.New("No version found for package " + pkgName)
return "", errors.New("No version found for package " + pkgName + ":" + targetNetVer)
}
}
......@@ -3,6 +3,7 @@ package main
import (
"io/ioutil"
"log"
"os"
"reflect"
"strings"
)
......@@ -64,3 +65,10 @@ func guessPkgNameFromVarName(varName string) string {
return strings.ReplaceAll(varName[3:], "_", ".")
}
func pathIsDir(path string) bool {
_, err := os.Stat(path)
if err == nil { return true }
if os.IsNotExist(err) { return false }
return false
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment