Add Pathclass.touch.

master
Ethan Dalool 2020-03-02 17:46:19 -08:00
parent 35eec077ed
commit 13f19719b2
1 changed files with 6 additions and 0 deletions

View File

@ -241,6 +241,12 @@ class Path:
def stat(self):
return os.stat(self.absolute_path)
def touch(self):
try:
os.utime(self.absolute_path)
except FileNotFoundError:
open(self.absolute_path, 'a').close()
def walk(self):
directories = []
for child in self.listdir():