bug fixes
This commit is contained in:
1 parent
b666285bd8
commit
c6fef39af5
4 files changed
+27
-16
No files matched your search
@@ -24,8 +24,8 @@ import (
|
||||
|
||||
var _name string = filepath.Base(os.Args[0])
|
||||
|
||||
func GetReposUrls() []string {
|
||||
f, err := os.Open(paths.ReposUrlsFile)
|
||||
func GetReposUrls(destDir string) []string {
|
||||
f, err := os.Open(filepath.Join(destDir, paths.ReposUrlsFile))
|
||||
if err != nil {
|
||||
return []string{}
|
||||
}
|
||||
@@ -160,9 +160,11 @@ func GetPackageVersion(name string, destDir string) string {
|
||||
|
||||
func RegPackage(name string, version string, destDir string) error {
|
||||
data := ReadInstalled(destDir)
|
||||
_, installed := data[name]
|
||||
if installed {
|
||||
if data[name][0].(string) != version {
|
||||
val, installed := data[name]
|
||||
|
||||
if installed && len(val) > 0 {
|
||||
currentVersion := fmt.Sprintf("%v", val[0])
|
||||
if currentVersion != version {
|
||||
data[name][0] = version
|
||||
}
|
||||
} else {
|
||||
@@ -175,7 +177,7 @@ func UnRegPackage(name string, destDir string) error {
|
||||
data := ReadInstalled(destDir)
|
||||
_, ok := data[name]
|
||||
if !ok {
|
||||
return fmt.Errorf("!! cant unregister '%s': package", name, "is not installed")
|
||||
return fmt.Errorf("cant unregister '%s': package is not installed", name)
|
||||
}
|
||||
delete(data, name)
|
||||
return WriteInstalled(data, destDir)
|
||||
|
||||
Reference in new issue
Block a user