|
@@ -180,7 +180,7 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) {
|
|
|
}
|
|
|
writer.Flush()
|
|
|
|
|
|
- zipPath = getUniqueFilename(exportFolder + ".db.zip")
|
|
|
+ zipPath = exportFolder + ".db.zip"
|
|
|
zip, err := gulu.Zip.Create(zipPath)
|
|
|
if nil != err {
|
|
|
logging.LogErrorf("create export .db.zip [%s] failed: %s", exportFolder, err)
|
|
@@ -209,24 +209,6 @@ func ExportAv2CSV(avID, blockID string) (zipPath string, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func getUniqueFilename(filePath string) string {
|
|
|
- if !gulu.File.IsExist(filePath) {
|
|
|
- return filePath
|
|
|
- }
|
|
|
-
|
|
|
- ext := filepath.Ext(filePath)
|
|
|
- base := strings.TrimSuffix(filepath.Base(filePath), ext)
|
|
|
- dir := filepath.Dir(filePath)
|
|
|
- i := 1
|
|
|
- for {
|
|
|
- newPath := filepath.Join(dir, base+" ("+strconv.Itoa(i)+ext) + ")"
|
|
|
- if !gulu.File.IsExist(newPath) {
|
|
|
- return newPath
|
|
|
- }
|
|
|
- i++
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
func Export2Liandi(id string) (err error) {
|
|
|
tree, err := LoadTreeByBlockID(id)
|
|
|
if nil != err {
|