Skip to content

Commit

Permalink
Create conf dir if not exists and remove empty conf dir
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye116477 committed Feb 10, 2022
1 parent 1db275e commit f0eee10
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 32 deletions.
18 changes: 13 additions & 5 deletions src/install_waterfox_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def install(sourcePath, installPath, chosenPackageType, installDesktopShortcut,

# Unpack Waterfox into the install directory
printDef(_("Unpackaging {package} into {installPath} directory...")
.format(package=os.path.basename(sourcePath), installPath=installPath))
.format(package=os.path.basename(sourcePath), installPath=installPath))
tempPath = pj(installPath, "temp")
if os.path.exists(tempPath):
shutil.rmtree(tempPath)
Expand Down Expand Up @@ -203,16 +203,20 @@ def install(sourcePath, installPath, chosenPackageType, installDesktopShortcut,
confG["InstallDesktopShortcut"] = installDesktopShortcut
confG["UseSystemDictionaries"] = useSystemDictionaries
confG["RemoveArchive"] = removeArchive
confDir = pj(os.getenv('XDG_CONFIG_HOME',
os.path.expanduser("~/.config")), "install_waterfox")
if not os.path.exists(confDir):
os.makedirs(confDir)
with open(configFilePath, 'w+', encoding='utf-8') as confFile:
conf.write(confFile)

# Finish
printDef("-----------------------------------")
grinningFace = "\N{grinning face}"
printDef(_("Waterfox {chosenPackageType} has been installed in {installPath} {grinningFace}!")
.format(chosenPackageType=chosenPackageType,
installPath=installPath,
grinningFace=grinningFace))
.format(chosenPackageType=chosenPackageType,
installPath=installPath,
grinningFace=grinningFace))


def uninstall(installPath, chosenPackageType, configFilePath, removeConfigFile, printDef):
Expand Down Expand Up @@ -284,9 +288,13 @@ def uninstall(installPath, chosenPackageType, configFilePath, removeConfigFile,
if removeConfigFile == "yes" and os.path.isfile(configFilePath):
printDef(_("Removing file with installer settings..."))
os.remove(configFilePath)
confDir = pj(os.getenv('XDG_CONFIG_HOME',
os.path.expanduser("~/.config")), "install_waterfox")
if not os.listdir(confDir):
os.rmdir(confDir)

# Finish
printDef("-----------------------------------")
disappointedFace = "\N{disappointed face}"
printDef(_("Waterfox {chosenPackageType} has been uninstalled {disappointedFace}.")
.format(chosenPackageType=chosenPackageType, disappointedFace=disappointedFace))
.format(chosenPackageType=chosenPackageType, disappointedFace=disappointedFace))
26 changes: 13 additions & 13 deletions src/locales/common/install_waterfox_common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: install_waterfox_common 1.5.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-10 23:26+0100\n"
"POT-Creation-Date: 2022-02-10 23:55+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -64,59 +64,59 @@ msgstr ""
msgid "Saving settings..."
msgstr ""

#: install_waterfox_common.py:212
#: install_waterfox_common.py:216
#, python-brace-format
msgid ""
"Waterfox {chosenPackageType} has been installed in {installPath} "
"{grinningFace}!"
msgstr ""

#: install_waterfox_common.py:223
#: install_waterfox_common.py:227
#, python-brace-format
msgid "Removing {appPath} directory..."
msgstr ""

#: install_waterfox_common.py:230
#: install_waterfox_common.py:234
msgid "Removing executable file..."
msgstr ""

#: install_waterfox_common.py:232
#: install_waterfox_common.py:236
#, python-brace-format
msgid "Root priveleges are required to remove {execFile}!"
msgstr ""

#: install_waterfox_common.py:244
#: install_waterfox_common.py:248
msgid "Removing start menu shortcut..."
msgstr ""

#: install_waterfox_common.py:246
#: install_waterfox_common.py:250
#, python-brace-format
msgid "Root priveleges are required to remove {path}!"
msgstr ""

#: install_waterfox_common.py:256
#: install_waterfox_common.py:260
msgid "Removing desktop shortcut..."
msgstr ""

#: install_waterfox_common.py:270 install_waterfox_common.py:274
#: install_waterfox_common.py:274 install_waterfox_common.py:278
#, python-brace-format
msgid "Removing {file} ..."
msgstr ""

#: install_waterfox_common.py:271
#: install_waterfox_common.py:275
msgid "Root priveleges are required to remove symlinks to icons!"
msgstr ""

#: install_waterfox_common.py:280
#: install_waterfox_common.py:284
#, python-brace-format
msgid "Removing empty {installPath} directory..."
msgstr ""

#: install_waterfox_common.py:285
#: install_waterfox_common.py:289
msgid "Removing file with installer settings..."
msgstr ""

#: install_waterfox_common.py:291
#: install_waterfox_common.py:299
#, python-brace-format
msgid "Waterfox {chosenPackageType} has been uninstalled {disappointedFace}."
msgstr ""
28 changes: 14 additions & 14 deletions src/locales/common/pl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: install_waterfox_common 1.5.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-10 23:26+0100\n"
"PO-Revision-Date: 2022-02-10 23:26+0100\n"
"POT-Creation-Date: 2022-02-10 23:55+0100\n"
"PO-Revision-Date: 2022-02-10 23:55+0100\n"
"Last-Translator: hawkeye116477\n"
"Language-Team: \n"
"Language: pl\n"
Expand Down Expand Up @@ -66,7 +66,7 @@ msgstr "Usuwanie {sourcePath} ..."
msgid "Saving settings..."
msgstr "Zapisywanie ustawień..."

#: install_waterfox_common.py:212
#: install_waterfox_common.py:216
#, python-brace-format
msgid ""
"Waterfox {chosenPackageType} has been installed in {installPath} "
Expand All @@ -75,52 +75,52 @@ msgstr ""
"Waterfox {chosenPackageType} został zainstalowany w {installPath} "
"{grinningFace}!"

#: install_waterfox_common.py:223
#: install_waterfox_common.py:227
#, python-brace-format
msgid "Removing {appPath} directory..."
msgstr "Usuwanie katalogu {appPath}..."

#: install_waterfox_common.py:230
#: install_waterfox_common.py:234
msgid "Removing executable file..."
msgstr "Usuwanie pliku wykonywalnego..."

#: install_waterfox_common.py:232
#: install_waterfox_common.py:236
#, python-brace-format
msgid "Root priveleges are required to remove {execFile}!"
msgstr "Do usunięcia {execFile} wymagane są uprawnienia roota!"

#: install_waterfox_common.py:244
#: install_waterfox_common.py:248
msgid "Removing start menu shortcut..."
msgstr "Usuwanie skrótu w menu start...."

#: install_waterfox_common.py:246
#: install_waterfox_common.py:250
#, python-brace-format
msgid "Root priveleges are required to remove {path}!"
msgstr "Do usunięcia {path} wymagane są uprawnienia roota!"

#: install_waterfox_common.py:256
#: install_waterfox_common.py:260
msgid "Removing desktop shortcut..."
msgstr "Usuwanie skrótu na pulpicie..."

#: install_waterfox_common.py:270 install_waterfox_common.py:274
#: install_waterfox_common.py:274 install_waterfox_common.py:278
#, python-brace-format
msgid "Removing {file} ..."
msgstr "Usuwanie {file} ..."

#: install_waterfox_common.py:271
#: install_waterfox_common.py:275
msgid "Root priveleges are required to remove symlinks to icons!"
msgstr "Aby usunąć symlinki do ikon, wymagane są uprawnienia roota!"

#: install_waterfox_common.py:280
#: install_waterfox_common.py:284
#, python-brace-format
msgid "Removing empty {installPath} directory..."
msgstr "Usuwanie pustego katalogu {installPath}..."

#: install_waterfox_common.py:285
#: install_waterfox_common.py:289
msgid "Removing file with installer settings..."
msgstr "Usuwanie pliku z ustawieniami instalatora..."

#: install_waterfox_common.py:291
#: install_waterfox_common.py:299
#, python-brace-format
msgid "Waterfox {chosenPackageType} has been uninstalled {disappointedFace}."
msgstr "Waterfox {chosenPackageType} został odinstalowany {disappointedFace}."

0 comments on commit f0eee10

Please sign in to comment.