Only write if file does not exist

main2
Bob Mottram 2019-11-02 11:32:43 +00:00
parent d6a17f1209
commit b877af4ae8
1 changed files with 6 additions and 5 deletions

View File

@ -146,11 +146,12 @@ def addShare(baseDir: str, \
# indicate that a new share is available
newShareFile=baseDir+'/accounts/.newShare'
try:
with open(newShareFile, 'w') as fp:
fp.write('\n')
except:
pass
if not os.path.isfile(newShareFile):
try:
with open(newShareFile, 'w') as fp:
fp.write('\n')
except:
pass
def expireShares(baseDir: str) -> None:
"""Removes expired items from shares