Merge pull request 'Add exists checks before making any changes to the datastore' (#92) from avoid-modify-datastore into release
Reviewed-on: #92
This commit is contained in:
commit
c6f89e9475
|
@ -75,6 +75,7 @@ def init():
|
||||||
with defaults if any issues.
|
with defaults if any issues.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if not USER.datadir.exists():
|
||||||
USER.datadir.mkdir(mode=0o755, exist_ok=True)
|
USER.datadir.mkdir(mode=0o755, exist_ok=True)
|
||||||
|
|
||||||
if not is_readable(USER.datadir.stat().st_mode):
|
if not is_readable(USER.datadir.stat().st_mode):
|
||||||
|
@ -84,6 +85,7 @@ def init():
|
||||||
)
|
)
|
||||||
USER.datadir.chmod(0o755)
|
USER.datadir.chmod(0o755)
|
||||||
|
|
||||||
|
if not USER.datafile.exists():
|
||||||
USER.datafile.touch(mode=0o644, exist_ok=True)
|
USER.datafile.touch(mode=0o644, exist_ok=True)
|
||||||
|
|
||||||
if not is_readable(USER.datafile.stat().st_mode):
|
if not is_readable(USER.datafile.stat().st_mode):
|
||||||
|
|
Loading…
Reference in New Issue