aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2018-05-27 17:40:33 +0700
committerShulhan <ms@kilabit.info>2018-05-27 17:40:33 +0700
commit5d0596c69943380932328ccb690cfe5f948bede4 (patch)
tree5a06e6d1c53760d1bb040cff4d649c27b44b74ab
parent22975b16c0971dff152f66083110093f2c07a602 (diff)
downloadbeku-5d0596c69943380932328ccb690cfe5f948bede4.tar.xz
install: check for non empty directory
-rw-r--r--env.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/env.go b/env.go
index 5edf5ff..c8c5958 100644
--- a/env.go
+++ b/env.go
@@ -819,6 +819,14 @@ func (env *Env) String() string {
// install a package.
//
func (env *Env) install(pkg *Package) (ok bool, err error) {
+ if !IsDirEmpty(pkg.FullPath) {
+ fmt.Printf(">>> Directory %s is not empty.\n", pkg.FullPath)
+ ok = confirm(os.Stdin, msgContinue, false)
+ if !ok {
+ return
+ }
+ }
+
err = pkg.Install()
if err != nil {
_ = pkg.Remove()