create config path if it doesn't exist before save

resovles https://todo.sr.ht/~thrrgilag/pantalaimon-ut/2
This commit is contained in:
Morgan McMillian 2020-08-09 13:30:44 -07:00
parent b9151456e4
commit 763fbf8e4f
4 changed files with 10 additions and 7 deletions

View file

@ -20,7 +20,7 @@ execute_process(
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}") set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
set(APP_NAME "Pantalaimon UT") set(APP_NAME "Pantalaimon UT")
set(APP_VERSION "0.2.0") set(APP_VERSION "0.3.0")
set(PROJECT_NAME "pantalaimon") set(PROJECT_NAME "pantalaimon")
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag") set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
set(CMAKE_INSTALL_PREFIX /) set(CMAKE_INSTALL_PREFIX /)

View file

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: pantalaimon.thrrgilag\n" "Project-Id-Version: pantalaimon.thrrgilag\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-07-26 01:40+0000\n" "POT-Creation-Date: 2020-08-09 20:24+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"

BIN
src/.config.py.swp Normal file

Binary file not shown.

View file

@ -5,15 +5,15 @@ import os
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
CONFFILE = '/home/phablet/.config/pantalaimon/pantalaimon.conf' CONFDIR = '/home/phablet/.config/pantalaimon/'
# CONFFILE = 'pantalaimon.conf' CONFFILE = 'pantalaimon.conf'
def load(): def load():
entries = [] entries = []
if os.path.exists(CONFFILE): if os.path.exists(CONFDIR + CONFFILE):
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read_file(open(CONFFILE)) config.read_file(open(CONFDIR + CONFFILE))
for instance in config.sections(): for instance in config.sections():
item = {'name': instance} item = {'name': instance}
@ -41,6 +41,9 @@ def save(data):
config[item['name']]['ignoreverification'] = "true" config[item['name']]['ignoreverification'] = "true"
config[item['name']]['usekeyring'] = "false" config[item['name']]['usekeyring'] = "false"
with open(CONFFILE,'w') as configfile: if not os.path.exists(CONFDIR):
os.makedirs(CONFDIR)
with open(CONFDIR + CONFFILE,'w') as configfile:
config.write(configfile) config.write(configfile)