Skip to content

Commit

Permalink
Updated install.py _get_default_profile_folder (yokoffing#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Denperidge authored Dec 9, 2024
1 parent 429abb6 commit d70e3cd
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Building into an exe (on Windows):
- pipx install pyinstaller (note: you can try without pipx, but this didn't work for me)
- Run:
- CMD: `pyinstaller --onefile --name install-betterfox install.py && move %cd%\dist\install-betterfox.exe %cd% && del install-betterfox.spec && rmdir /S /Q build && rmdir dist`
- CMD: `pyinstaller --onefile --name install-betterfox install.py && move %cd%\\dist\\install-betterfox.exe %cd% && del install-betterfox.spec && rmdir /S /Q build && rmdir dist`
- BASH: `pyinstaller --onefile --name install-betterfox install.py && && mv dist/install-betterfox.exe . && rm install-betterfox.spec && rm -rf ./build/ && rmdir dist`
(Sorry, didn't want to add a .gitignore solely for the install script)
- Done!
Expand Down Expand Up @@ -66,12 +66,25 @@ def _get_default_profile_folder():
config_parser = ConfigParser(strict=False)
config_parser.read(config_path)

path = None
for section in config_parser.sections():
if "Default" in config_parser[section]:
if config_parser[section]["Default"] == "1":
print("Default detected: " + section)
return FIREFOX_ROOT.joinpath(config_parser[section]["Path"])

section_default_value = config_parser[section]["Default"]
if section_default_value:
print("Default detected from section: " + section)
# Confirm whether a 0 value is possible, keep fallback until then
if section_default_value == "0":
continue
if section_default_value == "1":
path = config_parser[section]["Path"]
else:
path = section_default_value
break

if path is not None:
return FIREFOX_ROOT.joinpath(path)
else:
raise Exception("Could not determine default Firefox profile! Exiting...")

def _get_releases(repository_owner, repository_name):
releases = []
Expand Down

0 comments on commit d70e3cd

Please sign in to comment.