mirror of
https://github.com/aclist/dztui.git
synced 2026-10-31 15:12:48 +01:00
feat: add file module
This commit is contained in:
1 parent
24d3bc8209
commit
15d928026a
1 file changed
+15
@@ -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
|
||||||
Reference in new issue
Block a user