mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-28 00:16:32 +02:00
[core] more robust check of "status" file
This commit is contained in:
parent
fecec3eb40
commit
1993114178
1 changed files with 14 additions and 6 deletions
|
@ -288,11 +288,16 @@ class NodeChunk(BaseObject):
|
|||
self.statusFileLastModTime = -1
|
||||
self._status.reset()
|
||||
else:
|
||||
with open(statusFile, 'r') as jsonFile:
|
||||
statusData = json.load(jsonFile)
|
||||
self._status.fromDict(statusData)
|
||||
self.statusFileLastModTime = os.path.getmtime(statusFile)
|
||||
if oldStatus != self._status.status:
|
||||
try:
|
||||
with open(statusFile, 'r') as jsonFile:
|
||||
statusData = json.load(jsonFile)
|
||||
self.status.fromDict(statusData)
|
||||
self.statusFileLastModTime = os.path.getmtime(statusFile)
|
||||
except Exception as e:
|
||||
self.statusFileLastModTime = -1
|
||||
self.status.reset()
|
||||
|
||||
if oldStatus != self.status.status:
|
||||
self.statusChanged.emit()
|
||||
|
||||
@property
|
||||
|
@ -323,8 +328,11 @@ class NodeChunk(BaseObject):
|
|||
data = self._status.toDict()
|
||||
statusFilepath = self.statusFile
|
||||
folder = os.path.dirname(statusFilepath)
|
||||
if not os.path.exists(folder):
|
||||
try:
|
||||
os.makedirs(folder)
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
statusFilepathWriting = getWritingFilepath(statusFilepath)
|
||||
with open(statusFilepathWriting, 'w') as jsonFile:
|
||||
json.dump(data, jsonFile, indent=4)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue