create config path if it doesn't exist before save
resovles https://todo.sr.ht/~thrrgilag/pantalaimon-ut/2
This commit is contained in:
parent
b9151456e4
commit
763fbf8e4f
4 changed files with 10 additions and 7 deletions
|
@ -20,7 +20,7 @@ execute_process(
|
|||
set(QT_IMPORTS_DIR "lib/${ARCH_TRIPLET}")
|
||||
|
||||
set(APP_NAME "Pantalaimon UT")
|
||||
set(APP_VERSION "0.2.0")
|
||||
set(APP_VERSION "0.3.0")
|
||||
set(PROJECT_NAME "pantalaimon")
|
||||
set(FULL_PROJECT_NAME "pantalaimon.thrrgilag")
|
||||
set(CMAKE_INSTALL_PREFIX /)
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: pantalaimon.thrrgilag\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"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
|
BIN
src/.config.py.swp
Normal file
BIN
src/.config.py.swp
Normal file
Binary file not shown.
|
@ -5,15 +5,15 @@ import os
|
|||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
CONFFILE = '/home/phablet/.config/pantalaimon/pantalaimon.conf'
|
||||
# CONFFILE = 'pantalaimon.conf'
|
||||
CONFDIR = '/home/phablet/.config/pantalaimon/'
|
||||
CONFFILE = 'pantalaimon.conf'
|
||||
|
||||
def load():
|
||||
entries = []
|
||||
|
||||
if os.path.exists(CONFFILE):
|
||||
if os.path.exists(CONFDIR + CONFFILE):
|
||||
config = configparser.ConfigParser()
|
||||
config.read_file(open(CONFFILE))
|
||||
config.read_file(open(CONFDIR + CONFFILE))
|
||||
|
||||
for instance in config.sections():
|
||||
item = {'name': instance}
|
||||
|
@ -41,6 +41,9 @@ def save(data):
|
|||
config[item['name']]['ignoreverification'] = "true"
|
||||
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue