diff --git a/dzgui/util/file.py b/dzgui/util/file.py new file mode 100644 index 0000000..b655336 --- /dev/null +++ b/dzgui/util/file.py @@ -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