diff options
Diffstat (limited to 'rhimport/core.go')
-rw-r--r-- | rhimport/core.go | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/rhimport/core.go b/rhimport/core.go index 6afcd9f..dae4b34 100644 --- a/rhimport/core.go +++ b/rhimport/core.go @@ -160,9 +160,8 @@ type Context struct { ExtraMetaData map[string]string OrigFilename string Title string + WorkDir string SourceFile string - DeleteSourceFile bool - DeleteSourceDir bool SourceFilePolicy FilePolicy LoudnessCorr float64 ProgressCallBack ProgressCB @@ -202,8 +201,6 @@ func NewContext(conf *Config, db *rddb.DB, stdlog, dbglog *log.Logger) *Context ctx.OrigFilename = "" ctx.Title = "" ctx.SourceFile = "" - ctx.DeleteSourceFile = false - ctx.DeleteSourceDir = false ctx.LoudnessCorr = 0.0 ctx.SourceFilePolicy = Auto ctx.ProgressCallBack = nil @@ -267,6 +264,19 @@ func (ctx *Context) SanityCheck() error { return nil } +func (ctx *Context) CreateTempWorkDir() (err error) { + ctx.WorkDir, err = ioutil.TempDir(ctx.conf.TempDir, "rhimport-") + return +} + +func (ctx *Context) RemoveTempWorkDir() { + // check File Policy!!! + if err := os.RemoveAll(ctx.WorkDir); err != nil { + ctx.stdlog.Printf("Error removing WorkDir: %s", err) + } + return +} + func (ctx *Context) getPassword(cached bool) (err error) { ctx.Password, err = ctx.db.GetPassword(ctx.UserName, cached) return |