Change assetPath to a Path object

This commit is contained in:
Veronica Berglyd Olsen
2022-11-09 17:44:20 +01:00
parent 6792c11a71
commit 9d3291aba6
13 changed files with 142 additions and 151 deletions
+2 -3
View File
@@ -24,7 +24,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import os
import shutil
import logging
import novelwriter
@@ -431,8 +430,8 @@ class ProjectBuilder:
logger.error("No project path set for the example project")
return False
pkgSample = os.path.join(self.mainConf.assetPath, "sample.zip")
if os.path.isfile(pkgSample):
pkgSample = self.mainConf.getAssetPath("sample.zip")
if pkgSample.is_file():
try:
shutil.unpack_archive(pkgSample, projPath)
except Exception as exc:
+3 -3
View File
@@ -698,13 +698,13 @@ class NWProject(QObject):
def _loadProjectLocalisation(self):
"""Load the language data for the current project language.
"""
if self._data.language is None or self.mainConf.nwLangPath is None:
if self._data.language is None or self.mainConf._nwLangPath is None:
self._langData = {}
return False
langFile = Path(self.mainConf.nwLangPath) / f"project_{self._data.language}.json"
langFile = Path(self.mainConf._nwLangPath) / f"project_{self._data.language}.json"
if not langFile.is_file():
langFile = Path(self.mainConf.nwLangPath) / "project_en_GB.json"
langFile = Path(self.mainConf._nwLangPath) / "project_en_GB.json"
try:
with open(langFile, mode="r", encoding="utf-8") as inFile: