Skip to content

Commit

Permalink
Fixed settings.py to support Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahsoka committed Jul 9, 2021
1 parent bd27077 commit f2e65d9
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions beskar/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
import json
import os

location = None
try:
location = os.environ['PROGRAMDATA']
except KeyError:
location = None
if not location:
location = r'C:\ProgramData'

sentinel = object()

class Settings:
def __init__(self, location: Union[str, Literal[r'C:\Program Data']] = location):
self.settings_path = pathlib.Path(location) / 'Beskar' / 'settings.json'
def __init__(self, location: Union[str, Literal[r'C:\Program Data']] = None):
if os.name == 'nt':
if location is None:
try:
location = os.environ['PROGRAMDATA']
except KeyError:
location = None
if not location:
location = r'C:\ProgramData'
self.settings_path = pathlib.Path(location) / 'Beskar' / 'settings.json'
else:
self.settings_path = pathlib.Path('settings.json')
if self.settings_path.exists():
file_healthy = True
with self.settings_path.open() as file:
Expand Down

0 comments on commit f2e65d9

Please sign in to comment.