Check that content path exists before returning it from storage class (#1317)
This commit is contained in:
@@ -79,8 +79,16 @@ class NWStorage:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def contentPath(self):
|
def contentPath(self):
|
||||||
|
"""Return the path used for project content. The folder must
|
||||||
|
already exist, otherwise this property is None.
|
||||||
|
"""
|
||||||
if self._runtimePath is not None:
|
if self._runtimePath is not None:
|
||||||
return self._runtimePath / "content"
|
contentPath = self._runtimePath / "content"
|
||||||
|
if contentPath.is_dir():
|
||||||
|
return contentPath
|
||||||
|
else:
|
||||||
|
logger.error("Path not found: %s", contentPath)
|
||||||
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ def testCoreTree_ToCFile(monkeypatch, mockGUI, mockItems, tmpPath):
|
|||||||
assert theTree.writeToCFile() is False
|
assert theTree.writeToCFile() is False
|
||||||
|
|
||||||
theProject._storage._runtimePath = tmpPath
|
theProject._storage._runtimePath = tmpPath
|
||||||
|
(tmpPath / "content").mkdir()
|
||||||
assert theTree.writeToCFile() is True
|
assert theTree.writeToCFile() is True
|
||||||
|
|
||||||
pathA = str(Path("content") / "c000000000001.nwd")
|
pathA = str(Path("content") / "c000000000001.nwd")
|
||||||
|
|||||||
Reference in New Issue
Block a user