mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
🎨 Remove the target docx file when exporting Fix https://github.com/siyuan-note/siyuan/issues/8822
This commit is contained in:
parent
5822d1f7af
commit
bc36dc142a
6 changed files with 21 additions and 6 deletions
|
|
@ -1236,6 +1236,7 @@
|
|||
"211": "Cloud data verification complete",
|
||||
"212": "There are some defects in the current version of cloud data sync, please upgrade to the latest version. Sorry for the inconvenience",
|
||||
"213": "Cloud verification failed, please try to upgrade to the latest version and log in again before syncing",
|
||||
"214": "This function needs to be logged in to use"
|
||||
"214": "This function needs to be signed in to use",
|
||||
"215": "保存失败:目标文件并且正在被其他程序占用"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,7 @@
|
|||
"211": "Verificaci\u00f3n de datos en la nube completada",
|
||||
"212": "Hay algunos defectos en la versi\u00f3n actual de sincronizaci\u00f3n de datos en la nube, actualice a la versi\u00f3n m\u00e1s reciente. Disculpe las molestias",
|
||||
"213": "La verificaci\u00f3n en la nube fall\u00f3, intente actualizar a la versi\u00f3n m\u00e1s reciente e inicie sesi\u00f3n de nuevo antes de sincronizar",
|
||||
"214": "Esta función requiere iniciar sesión en la cuenta antes de poder usarla"
|
||||
"214": "Esta función requiere iniciar sesión en la cuenta antes de poder usarla",
|
||||
"215": "Error al guardar: el archivo objetivo esta siendo usado por otro programa"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,7 @@
|
|||
"211": "Vérification des données cloud terminée",
|
||||
"212": "Il y a quelques défauts dans la version actuelle de la synchronisation des données cloud, veuillez mettre à niveau vers la dernière version. Désolé pour le désagrément",
|
||||
"213": "Échec de la vérification cloud, veuillez essayer de mettre à niveau vers la dernière version et de vous reconnecter avant de synchroniser",
|
||||
"214": "La fonctionnalité nécessite un numéro de compte de connexion avant de pouvoir être utilisée"
|
||||
"214": "La fonctionnalité nécessite un numéro de compte de connexion avant de pouvoir être utilisée",
|
||||
"215": "Échec de l'enregistrement : le fichier cible est utilisé par un autre programme"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,7 @@
|
|||
"211": "校驗雲端數據完畢",
|
||||
"212": "當前版本雲端數據同步存在一些缺陷,請升級到最新版,帶來不便,敬請諒解",
|
||||
"213": "雲端校驗失敗,請嘗試升級到最新版並重新登錄後再進行同步",
|
||||
"214": "該功能需要登錄賬號後才能使用"
|
||||
"214": "該功能需要登錄賬號後才能使用",
|
||||
"215": "保存失敗:目標文件並且正在被其他程序佔用"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1236,6 +1236,7 @@
|
|||
"211": "校验云端数据完毕",
|
||||
"212": "当前版本云端数据同步存在一些缺陷,请升级到最新版,带来不便,敬请谅解",
|
||||
"213": "云端校验失败,请尝试升级到最新版并重新登录后再进行同步",
|
||||
"214": "该功能需要登录账号后才能使用"
|
||||
"214": "该功能需要登录账号后才能使用",
|
||||
"215": "保存失败:目标文件并且正在被其他程序占用"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -377,7 +377,17 @@ func ExportDocx(id, savePath string, removeAssets, merge bool) (err error) {
|
|||
return errors.New(msg)
|
||||
}
|
||||
|
||||
if err = filelock.Copy(tmpDocxPath, filepath.Join(savePath, name+".docx")); nil != err {
|
||||
targetPath := filepath.Join(savePath, name+".docx")
|
||||
if gulu.File.IsExist(targetPath) {
|
||||
// 先删除目标文件,以检查是否被占用 https://github.com/siyuan-note/siyuan/issues/8822
|
||||
if err := os.RemoveAll(targetPath); nil != err {
|
||||
logging.LogErrorf("export docx failed: %s", err)
|
||||
msg := fmt.Sprintf(Conf.language(215))
|
||||
return errors.New(msg)
|
||||
}
|
||||
}
|
||||
|
||||
if err = filelock.Copy(tmpDocxPath, targetPath); nil != err {
|
||||
logging.LogErrorf("export docx failed: %s", err)
|
||||
return errors.New(fmt.Sprintf(Conf.Language(14), err))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue