Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
feat(save_img): 不再每次删除cache
Browse files Browse the repository at this point in the history
  • Loading branch information
ambition_echo committed Nov 22, 2022
1 parent cc6317f commit 5be4c88
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions earth_wallpaper/systemtray.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ def save_current_img():
picture_dir = QStandardPaths.writableLocation(QStandardPaths.PicturesLocation) + "/earth-wallpaper"
if not QDir(picture_dir).exists():
QDir(picture_dir).mkpath(picture_dir)
source = QFile(os.path.join(img_dir, files[0]))
source = QFile(os.path.join(img_dir, files[-1]))

target = QFile(os.path.join(picture_dir, files[0]))
target = QFile(os.path.join(picture_dir, files[-1]))
message = QMessageBox()
if not target.exists():
if source.copy(target.fileName()):
logger.info(f"保存{os.path.join(img_dir, files[0])}{os.path.join(picture_dir, files[0])}")
logger.info(f"保存{os.path.join(img_dir, files[-1])}{os.path.join(picture_dir, files[-1])}")
QMessageBox.information(message, "保存", "保存成功,已保存到用户Picture目录", QMessageBox.Yes)
else:
logger.warning("保存失败,原因未知")
Expand Down
6 changes: 4 additions & 2 deletions earth_wallpaper/utils/platformInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ def log_path() -> str:

def check(self):
if os.path.exists(self.download_dir()):
shutil.rmtree(self.download_dir())
os.makedirs(self.download_dir())
pass
# shutil.rmtree(self.download_dir())
else:
os.makedirs(self.download_dir())

def get_os(self):
return self.sys

0 comments on commit 5be4c88

Please sign in to comment.