This commit is contained in:
@ -1,5 +1,11 @@
|
|||||||
# 更新笔记
|
# 更新笔记
|
||||||
|
|
||||||
|
## v1.2.1
|
||||||
|
|
||||||
|
_Bug fixes_
|
||||||
|
|
||||||
|
- 修复没有 temp 文件夹的 bug
|
||||||
|
|
||||||
## v1.2.0
|
## v1.2.0
|
||||||
|
|
||||||
_Bug fixes_
|
_Bug fixes_
|
||||||
|
@ -3,6 +3,7 @@ import shutil
|
|||||||
|
|
||||||
def save_file(name, data):
|
def save_file(name, data):
|
||||||
temp_path = os.path.join(os.path.dirname(__file__), 'temp')
|
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:
|
with open(os.path.join(temp_path, name), 'wb') as code:
|
||||||
code.write(data)
|
code.write(data)
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ def remove_file(path):
|
|||||||
|
|
||||||
def clear_dir():
|
def clear_dir():
|
||||||
temp_path = os.path.join(os.path.dirname(__file__), 'temp')
|
temp_path = os.path.join(os.path.dirname(__file__), 'temp')
|
||||||
|
check_dir(temp_path)
|
||||||
flag = True
|
flag = True
|
||||||
for files in os.listdir(temp_path):
|
for files in os.listdir(temp_path):
|
||||||
path = os.path.join(temp_path, files)
|
path = os.path.join(temp_path, files)
|
||||||
@ -26,4 +28,9 @@ def clear_dir():
|
|||||||
|
|
||||||
print('Info: temp dir is cleared')
|
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
|
||||||
|
|
Reference in New Issue
Block a user