patcher: add option to specify predefined patch url
This option adds patch_provider to Patcher class, currently you can choose either y0soro or Krock (by default it uses y0soro for latest 3.0.0 patch)
This commit is contained in:
@ -29,10 +29,12 @@ except ImportError:
|
||||
|
||||
class Patcher:
|
||||
def __init__(self, gamedir: Path | AsyncPath | str = AsyncPath.cwd(), data_dir: str | Path | AsyncPath = None,
|
||||
patch_url: str = None, overseas=True):
|
||||
patch_url: str = None, overseas=True, patch_provider="y0soro"):
|
||||
if isinstance(gamedir, str | Path):
|
||||
gamedir = AsyncPath(gamedir)
|
||||
self._gamedir = gamedir
|
||||
if not patch_url:
|
||||
patch_url = constants.PATCH_LIST[patch_provider].replace("http://", "https://")
|
||||
self._patch_url = (patch_url if patch_url else constants.PATCH_GIT_URL).replace('http://', 'https://')
|
||||
if not data_dir:
|
||||
self._appdirs = constants.APPDIRS
|
||||
@ -309,3 +311,4 @@ class Patcher:
|
||||
|
||||
async def clear_cache(self):
|
||||
await asyncio.to_thread(shutil.rmtree, self._temp_path, ignore_errors=True)
|
||||
await asyncio.to_thread(shutil.rmtree, self._patch_path, ignore_errors=True)
|
||||
|
||||
Reference in New Issue
Block a user