mirror of
https://github.com/mindoc-org/mindoc.git
synced 2025-10-20 19:07:25 +08:00
修复导出目录路径BUG
This commit is contained in:
@@ -191,12 +191,15 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
|
|||||||
docxpath := filepath.Join(outputPath, "book.docx")
|
docxpath := filepath.Join(outputPath, "book.docx")
|
||||||
|
|
||||||
//先将转换的文件储存到临时目录
|
//先将转换的文件储存到临时目录
|
||||||
tempOutputPath := filepath.Join(os.TempDir(),"sessionId") //filepath.Abs(filepath.Join("cache", sessionId))
|
tempOutputPath := filepath.Join(os.TempDir(),sessionId) //filepath.Abs(filepath.Join("cache", sessionId))
|
||||||
|
|
||||||
os.MkdirAll(outputPath, 0766)
|
os.MkdirAll(outputPath, 0766)
|
||||||
os.MkdirAll(tempOutputPath, 0766)
|
os.MkdirAll(tempOutputPath, 0766)
|
||||||
|
|
||||||
|
defer func(p string) {
|
||||||
|
os.RemoveAll(p)
|
||||||
|
}(tempOutputPath)
|
||||||
|
|
||||||
if utils.FileExists(pdfpath) && utils.FileExists(epubpath) && utils.FileExists(mobipath) && utils.FileExists(docxpath) {
|
if utils.FileExists(pdfpath) && utils.FileExists(epubpath) && utils.FileExists(mobipath) && utils.FileExists(docxpath) {
|
||||||
convertBookResult.EpubPath = epubpath
|
convertBookResult.EpubPath = epubpath
|
||||||
convertBookResult.MobiPath = mobipath
|
convertBookResult.MobiPath = mobipath
|
||||||
@@ -329,9 +332,7 @@ func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error) {
|
|||||||
return convertBookResult, err
|
return convertBookResult, err
|
||||||
}
|
}
|
||||||
beego.Info("文档转换完成:" + m.BookName)
|
beego.Info("文档转换完成:" + m.BookName)
|
||||||
defer func(p string) {
|
|
||||||
os.RemoveAll(p)
|
|
||||||
}(tempOutputPath)
|
|
||||||
|
|
||||||
utils.CopyFile(mobipath, filepath.Join(tempOutputPath, "output", "book.mobi"))
|
utils.CopyFile(mobipath, filepath.Join(tempOutputPath, "output", "book.mobi"))
|
||||||
utils.CopyFile(pdfpath, filepath.Join(tempOutputPath, "output", "book.pdf"))
|
utils.CopyFile(pdfpath, filepath.Join(tempOutputPath, "output", "book.pdf"))
|
||||||
|
Reference in New Issue
Block a user