updater: do not delete directory
I took a look at deletefiles.txt again and realized that they're all files, so we don't need to delete the entire directory Signed-off-by: tretrauit <tretrauit@gmail.com>
This commit is contained in:
parent
727b7e9b44
commit
e55d6cafd6
@ -1,3 +1,3 @@
|
||||
aiohttp==3.8.1
|
||||
aiohttp==3.8.3
|
||||
appdirs~=1.4.4
|
||||
aiopath~=0.6.10
|
3
setup.py
3
setup.py
@ -1,4 +1,5 @@
|
||||
import pathlib
|
||||
|
||||
from setuptools import setup
|
||||
|
||||
# The directory containing this file
|
||||
@ -9,7 +10,7 @@ README = (HERE / "README.md").read_text()
|
||||
|
||||
setup(
|
||||
name='worthless',
|
||||
version='2.2.7',
|
||||
version='2.2.8',
|
||||
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
|
||||
url='https://git.froggi.es/tretrauit/worthless-launcher',
|
||||
license='MIT License',
|
||||
|
@ -1,14 +1,16 @@
|
||||
import asyncio
|
||||
import hashlib
|
||||
import json
|
||||
import platform
|
||||
import re
|
||||
import shutil
|
||||
import platform
|
||||
import aiohttp
|
||||
import zipfile
|
||||
import json
|
||||
import hashlib
|
||||
from pathlib import Path
|
||||
from configparser import ConfigParser
|
||||
from pathlib import Path
|
||||
|
||||
import aiohttp
|
||||
from aiopath import AsyncPath
|
||||
|
||||
from worthless import constants
|
||||
from worthless.launcher import Launcher
|
||||
from worthless.launcherconfig import LauncherConfig
|
||||
@ -387,15 +389,12 @@ class Installer:
|
||||
deletefiles = archive.read("deletefiles.txt").decode().split("\n")
|
||||
for file in deletefiles:
|
||||
current_game_file = Path(self._gamedir.joinpath(file))
|
||||
if current_game_file == self._gamedir:
|
||||
if current_game_file == Path(self._gamedir):
|
||||
continue
|
||||
if not current_game_file.exists():
|
||||
if not current_game_file.is_file():
|
||||
continue
|
||||
if current_game_file.is_file():
|
||||
current_game_file.unlink(missing_ok=True)
|
||||
continue
|
||||
if current_game_file.is_dir():
|
||||
shutil.rmtree(current_game_file, ignore_errors=True)
|
||||
print("Deleting ", file)
|
||||
current_game_file.unlink(missing_ok=True)
|
||||
|
||||
await asyncio.to_thread(archive.extractall, self._gamedir, members=files)
|
||||
archive.close()
|
||||
|
Loading…
Reference in New Issue
Block a user