fix: temp
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
mol
2023-09-06 10:13:57 +08:00
parent 1d7dbeb749
commit a2d324fb07
2 changed files with 13 additions and 0 deletions

View File

@ -3,6 +3,7 @@ import shutil
def save_file(name, data):
temp_path = os.path.join(os.path.dirname(__file__), 'temp')
check_dir(temp_path)
with open(os.path.join(temp_path, name), 'wb') as code:
code.write(data)
@ -15,6 +16,7 @@ def remove_file(path):
def clear_dir():
temp_path = os.path.join(os.path.dirname(__file__), 'temp')
check_dir(temp_path)
flag = True
for files in os.listdir(temp_path):
path = os.path.join(temp_path, files)
@ -26,4 +28,9 @@ def clear_dir():
print('Info: temp dir is cleared')
def check_dir(path):
is_exists = os.path.exists(path)
if not(is_exists):
os.mkdir(path.encode('utf-8'))
return