瀏覽代碼

Use BuildDir instead of cacheHome to store PKGBUILDS with -G

BuildDir resolves to same place as cacheHome by default but it's configurable which helps in case user want to chose different directory to store PKGBUILDS.
Maryse47 5 年之前
父節點
當前提交
f8339fc568
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      download.go

+ 3 - 3
download.go

@@ -299,12 +299,12 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
 
 	download := func(pkg string, url string) {
 		defer wg.Done()
-		if _, err := gitDownloadABS(url, cacheHome, pkg); err != nil {
+		if _, err := gitDownloadABS(url, config.BuildDir, pkg); err != nil {
 			errs.Add(fmt.Errorf("%s Failed to get pkgbuild: %s: %s", bold(red(arrow)), bold(cyan(pkg)), bold(red(err.Error()))))
 			return
 		}
 
-		_, stderr, err := capture(exec.Command("ln", "-s", filepath.Join(cacheHome, pkg, "trunk"), filepath.Join(path, pkg)))
+		_, stderr, err := capture(exec.Command("ln", "-s", filepath.Join(config.BuildDir, pkg, "trunk"), filepath.Join(path, pkg)))
 		mux.Lock()
 		downloaded++
 		if err != nil {
@@ -326,6 +326,6 @@ func getPkgbuildsfromABS(pkgs []string, path string) (bool, error) {
 	}
 
 	wg.Wait()
-	errs.Add(os.RemoveAll(filepath.Join(cacheHome, "packages")))
+	errs.Add(os.RemoveAll(filepath.Join(config.BuildDir, "packages")))
 	return len(missing) != 0, errs.Return()
 }