Skip to content

Commit d70e3cd

Browse files
authored
Updated install.py _get_default_profile_folder (#346)
1 parent 429abb6 commit d70e3cd

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

install.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
Building into an exe (on Windows):
3333
- pipx install pyinstaller (note: you can try without pipx, but this didn't work for me)
3434
- Run:
35-
- 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`
35+
- 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`
3636
- BASH: `pyinstaller --onefile --name install-betterfox install.py && && mv dist/install-betterfox.exe . && rm install-betterfox.spec && rm -rf ./build/ && rmdir dist`
3737
(Sorry, didn't want to add a .gitignore solely for the install script)
3838
- Done!
@@ -66,12 +66,25 @@ def _get_default_profile_folder():
6666
config_parser = ConfigParser(strict=False)
6767
config_parser.read(config_path)
6868

69+
path = None
6970
for section in config_parser.sections():
7071
if "Default" in config_parser[section]:
71-
if config_parser[section]["Default"] == "1":
72-
print("Default detected: " + section)
73-
return FIREFOX_ROOT.joinpath(config_parser[section]["Path"])
74-
72+
section_default_value = config_parser[section]["Default"]
73+
if section_default_value:
74+
print("Default detected from section: " + section)
75+
# Confirm whether a 0 value is possible, keep fallback until then
76+
if section_default_value == "0":
77+
continue
78+
if section_default_value == "1":
79+
path = config_parser[section]["Path"]
80+
else:
81+
path = section_default_value
82+
break
83+
84+
if path is not None:
85+
return FIREFOX_ROOT.joinpath(path)
86+
else:
87+
raise Exception("Could not determine default Firefox profile! Exiting...")
7588

7689
def _get_releases(repository_owner, repository_name):
7790
releases = []

0 commit comments

Comments
 (0)