Commit c35db822 authored by Jacek Sowiński's avatar Jacek Sowiński

Search for config also in ~/.config/topydo/config

Also move home_config_path() out of the Config class. It didn't use
'self' argument and this way we can reuse it other places.
parent 741a47c2
...@@ -18,6 +18,9 @@ import configparser ...@@ -18,6 +18,9 @@ import configparser
import os import os
import shlex import shlex
def home_config_path(p_filename):
return os.path.join(os.path.expanduser('~'), p_filename)
class ConfigError(Exception): class ConfigError(Exception):
def __init__(self, p_text): def __init__(self, p_text):
self.text = p_text self.text = p_text
...@@ -120,7 +123,8 @@ class _Config: ...@@ -120,7 +123,8 @@ class _Config:
files = [ files = [
"/etc/topydo.conf", "/etc/topydo.conf",
self._home_config_path(), home_config_path('.config/topydo/config'),
home_config_path('.topydo'),
".topydo", ".topydo",
"topydo.conf", "topydo.conf",
"topydo.ini", "topydo.ini",
...@@ -143,9 +147,6 @@ class _Config: ...@@ -143,9 +147,6 @@ class _Config:
if not self.cp.has_section(section): if not self.cp.has_section(section):
self.cp.add_section(section) self.cp.add_section(section)
def _home_config_path(self):
return os.path.join(os.path.expanduser('~'), '.topydo')
def default_command(self): def default_command(self):
return self.cp.get('topydo', 'default_command') return self.cp.get('topydo', 'default_command')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment