Fix enchant folder missing bug for dictionaries tool (#1874)
This commit is contained in:
@@ -36,7 +36,7 @@ from PyQt5.QtWidgets import (
|
||||
)
|
||||
|
||||
from novelwriter import CONFIG, SHARED
|
||||
from novelwriter.common import formatFileFilter, openExternalPath, formatInt, getFileSize
|
||||
from novelwriter.common import formatFileFilter, formatInt, getFileSize, openExternalPath
|
||||
from novelwriter.error import formatException
|
||||
from novelwriter.extensions.modified import NIconToolButton
|
||||
from novelwriter.types import QtDialogClose
|
||||
@@ -143,11 +143,12 @@ class GuiDictionaries(QDialog):
|
||||
try:
|
||||
import enchant
|
||||
path = Path(enchant.get_user_config_dir())
|
||||
self._installPath = Path(path).resolve()
|
||||
self._installPath.mkdir(exist_ok=True, parents=True)
|
||||
except Exception:
|
||||
logger.error("Could not get enchant path")
|
||||
return False
|
||||
|
||||
self._installPath = Path(path).resolve()
|
||||
if path.is_dir():
|
||||
self.inPath.setText(str(path))
|
||||
hunspell = path / "hunspell"
|
||||
@@ -199,9 +200,9 @@ class GuiDictionaries(QDialog):
|
||||
if self._installPath:
|
||||
temp = self.huInput.text()
|
||||
if temp and (path := Path(temp)).is_file():
|
||||
hunspell = self._installPath / "hunspell"
|
||||
hunspell.mkdir(exist_ok=True)
|
||||
try:
|
||||
hunspell = self._installPath / "hunspell"
|
||||
hunspell.mkdir(exist_ok=True)
|
||||
nAff, nDic = self._extractDicts(path, hunspell)
|
||||
if nAff == 0 or nDic == 0:
|
||||
self._appendLog(procErr, err=True)
|
||||
|
||||
Reference in New Issue
Block a user