Remove project cache attribute from project class

This commit is contained in:
Veronica Berglyd Olsen
2022-11-05 23:33:50 +01:00
parent 21ab4e58f9
commit 972ed25a8c
4 changed files with 17 additions and 29 deletions
+10 -3
View File
@@ -29,6 +29,7 @@ import logging
import novelwriter
from time import time
from pathlib import Path
from datetime import datetime
from PyQt5.QtGui import (
@@ -1088,9 +1089,12 @@ class GuiBuildNovel(QDialog):
def _loadCache(self):
"""Save the current data to cache.
"""
buildCache = os.path.join(self.theProject.projCache, nwFiles.BUILD_CACHE)
buildCache = self.theProject.storage.getCacheFile(nwFiles.BUILD_CACHE)
if not isinstance(buildCache, Path):
return False
dataCount = 0
if os.path.isfile(buildCache):
if buildCache.exists():
logger.debug("Loading build cache")
try:
with open(buildCache, mode="r", encoding="utf-8") as inFile:
@@ -1115,7 +1119,10 @@ class GuiBuildNovel(QDialog):
def _saveCache(self):
"""Save the current data to cache.
"""
buildCache = os.path.join(self.theProject.projCache, nwFiles.BUILD_CACHE)
buildCache = self.theProject.storage.getCacheFile(nwFiles.BUILD_CACHE)
if not isinstance(buildCache, Path):
return False
logger.debug("Saving build cache")
try:
with open(buildCache, mode="w+", encoding="utf-8") as outFile: