Add Pathclass.touch.

This commit is contained in:
Ethan Dalool 2020-03-02 17:46:19 -08:00
parent 35eec077ed
commit 13f19719b2

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():