Skip to content

Commit

Permalink
fix: update config file permissions (#143, #157)
Browse files Browse the repository at this point in the history
  • Loading branch information
iholston committed Nov 27, 2023
1 parent aa6aa9c commit 924d6bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lolbot/bot/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import sys
import stat
import logging
import shutil
import subprocess
Expand Down Expand Up @@ -44,10 +45,12 @@ def launch_league(self, username: str, password: str) -> None:
def set_game_config(self) -> None:
"""Overwrites the League of Legends game config"""
self.log.info("Overwriting/creating game config")
if os.path.exists(self.config.get_data('league_config')):
shutil.copy(utils.resource_path(Constants.GAME_CFG), self.config.get_data('league_config'))
path = self.config.get_data('league_config')
if os.path.exists(path):
os.chmod(path, stat.S_IWRITE)
shutil.copy(utils.resource_path(Constants.GAME_CFG), path)
else:
shutil.copy2(utils.resource_path(Constants.GAME_CFG), self.config.get_data('league_config'))
shutil.copy2(utils.resource_path(Constants.GAME_CFG), path)

def launch_loop(self) -> None:
"""Handles tasks necessary to open the League of Legends client"""
Expand Down

0 comments on commit 924d6bd

Please sign in to comment.