summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-03-11 17:07:19 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-03-11 17:07:19 (GMT)
commitcb4a3b0f857bf0c9c50387cb5dd0764a1082092d (patch)
tree382334b52d1317916f16fefdf3ef3781ab66338d
parente22e19a7ab173a43376ff19da9eaf6d50032c915 (diff)
make FilePolicy more precise
-rw-r--r--rhimport/core.go1
-rw-r--r--rhimport/fetcher.go12
2 files changed, 13 insertions, 0 deletions
diff --git a/rhimport/core.go b/rhimport/core.go
index efb6e58..e6c6624 100644
--- a/rhimport/core.go
+++ b/rhimport/core.go
@@ -70,6 +70,7 @@ const (
Auto FilePolicy = iota
Keep
Delete
+ DeleteWithDir
)
type Context struct {
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index 1f1e84f..dd4b6df 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -415,5 +415,17 @@ func FetchFile(ctx *Context) (res *Result, err error) {
} else {
err = fmt.Errorf("No fetcher for uri scheme '%s' found.", uri.Scheme)
}
+
+ switch ctx.SourceFilePolicy {
+ case Keep:
+ ctx.DeleteSourceFile = false
+ ctx.DeleteSourceDir = false
+ case DeleteWithDir:
+ ctx.DeleteSourceDir = true
+ fallthrough
+ case Delete:
+ ctx.DeleteSourceFile = true
+ }
+
return
}