mirror of
https://github.com/aclist/dztui.git
synced 2026-08-27 02:07:18 +02:00
feat: add file module
This commit is contained in:
parent
24d3bc8209
commit
15d928026a
15
dzgui/util/file.py
Normal file
15
dzgui/util/file.py
Normal file
@ -0,0 +1,15 @@
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def is_writeable(path: "Path") -> bool:
|
||||
now = int(datetime.now().timestamp())
|
||||
suffix = ".dzgtmp"
|
||||
file = str(now) + suffix
|
||||
filepath = Path(str(path) + "_" + file)
|
||||
try:
|
||||
filepath.touch()
|
||||
filepath.unlink()
|
||||
return True
|
||||
except OSError:
|
||||
return False
|
||||
Loading…
Reference in New Issue
Block a user