mirror of
https://github.com/deadc0de6/catcli
synced 2024-11-11 13:11:00 +00:00
refactoring
This commit is contained in:
parent
7e0447265d
commit
ed931cc822
@ -102,18 +102,6 @@ def create_rnd_file(path, filename, content=None):
|
|||||||
return write_to_file(fpath, content)
|
return write_to_file(fpath, content)
|
||||||
|
|
||||||
|
|
||||||
def remove(path):
|
|
||||||
'''Delete file or directory.'''
|
|
||||||
if not os.path.exists(path):
|
|
||||||
return
|
|
||||||
if os.path.islink(path):
|
|
||||||
os.remove(path)
|
|
||||||
elif os.path.isdir(path):
|
|
||||||
shutil.rmtree(path)
|
|
||||||
else:
|
|
||||||
os.remove(path)
|
|
||||||
|
|
||||||
|
|
||||||
def write_to_file(path, content):
|
def write_to_file(path, content):
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
Loading…
Reference in New Issue
Block a user