summaryrefslogtreecommitdiff
path: root/rhimport/core.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-08-04 16:25:04 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-08-04 16:25:04 (GMT)
commit9561889b4c683f602eb9623deeec2bd020d486da (patch)
treeec7c18db53fef5b3d51ead735ed3f2712aed236c /rhimport/core.go
parent6107b08a3f4f66bcbb5da9a84b43f19030d0fbc6 (diff)
some more bugfixes for new source file policy semantics
Diffstat (limited to 'rhimport/core.go')
-rw-r--r--rhimport/core.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/rhimport/core.go b/rhimport/core.go
index 2acec51..12ad35c 100644
--- a/rhimport/core.go
+++ b/rhimport/core.go
@@ -206,6 +206,9 @@ func (ctx *Context) SanityCheck() error {
if ctx.Password == "" && !ctx.Trusted {
return fmt.Errorf("empty Password on untrusted control interface is not allowed")
}
+ if ctx.WorkDir == "" {
+ return fmt.Errorf("empty WorkDir is not allowed")
+ }
if ctx.ShowId != 0 {
if ctx.ShowId != 0 && ctx.ShowId > CART_MAX {
return fmt.Errorf("ShowId %d is outside of allowed range (0 < show-id < %d)", ctx.ShowId, CART_MAX)
@@ -259,6 +262,12 @@ func (ctx *Context) CreateTempWorkDir() (err error) {
return
}
+func (ctx *Context) SwitchTempWorkDir(newDir string) {
+ ctx.RemoveTempWorkDir()
+ ctx.WorkDir = newDir
+ return
+}
+
func (ctx *Context) RemoveTempWorkDir() {
if err := os.RemoveAll(ctx.WorkDir); err != nil {
ctx.stdlog.Printf("Error removing WorkDir: %s", err)
@@ -313,7 +322,7 @@ func (ctx *Context) reportProgress(step int, stepName string, current, total flo
title := ctx.Title
if title == "" {
title = path.Base(ctx.OrigFilename)
- if title == "" {
+ if title == "" || title == "." {
title = path.Base(ctx.SourceFile)
}
}