@ -1591,7 +1591,17 @@ class NsmServerControl(object):
entry [ " sessionFile " ] = sessionFile
entry [ " lockFile " ] = pathlib . Path ( basePath , " .lock " )
entry [ " fullPath " ] = str ( basePath )
entry [ " sizeInBytes " ] = sum ( f . stat ( ) . st_size for f in basePath . glob ( ' **/* ' ) if f . is_file ( ) )
#No generator expression for the next one. We need to watch out for PermissionError (sudo chmod 000)
sizeInBytes = 0
for f in basePath . glob ( ' **/* ' ) :
try :
if f . exists ( ) and f . is_file ( ) :
sizeInBytes + = f . stat ( ) . st_size
except PermissionError :
logger . error ( f " PermissionError for { f } . It is possible that the file is read-protected. Trying to load the session anyway, please be careful. " )
entry [ " sizeInBytes " ] = sizeInBytes
entry [ " numberOfClients " ] = len ( open ( sessionFile ) . readlines ( ) )
entry [ " hasSymlinks " ] = self . _checkDirectoryForSymlinks ( basePath )
entry [ " parents " ] = basePath . relative_to ( self . sessionRoot ) . parts [ : - 1 ] #tuple of each dir between NSM root and nsmSessionName/session.nsm, exluding the actual project name. This is the tree