diff --git a/converter/converter.go b/converter/converter.go index 6d89e3c0..bf16512f 100644 --- a/converter/converter.go +++ b/converter/converter.go @@ -458,15 +458,15 @@ func (this *Converter) convertToEpub() (err error) { filepath.Join(this.OutputPath, "content.epub"), filepath.Join(this.OutputPath, output, "book.epub"), } - cmd := exec.Command(ebookConvert, args...) + //cmd := exec.Command(ebookConvert, args...) + // + //if this.Debug { + // fmt.Println(cmd.Args) + //} + //fmt.Println("正在转换EPUB文件", args[0]) + //return cmd.Run() - if this.Debug { - fmt.Println(cmd.Args) - } - fmt.Println("正在转换EPUB文件", args[0]) - return cmd.Run() - - //return filetil.CopyFile(filepath.Join(this.OutputPath, "content.epub"),filepath.Join(this.OutputPath, output, "book.epub")) + return filetil.CopyFile(args[0],args[1]) } //转成mobi diff --git a/models/book_result.go b/models/book_result.go index 175fa3e3..0d735370 100644 --- a/models/book_result.go +++ b/models/book_result.go @@ -232,9 +232,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) { beego.Error("创建目录失败 => ",tempOutputPath,err) } - defer func(p string) { - os.RemoveAll(p) - }(tempOutputPath) + defer os.RemoveAll(strings.TrimSuffix(tempOutputPath,"source")) if filetil.FileExists(pdfpath) && filetil.FileExists(epubpath) && filetil.FileExists(mobipath) && filetil.FileExists(docxpath) { convertBookResult.EpubPath = epubpath