core, memory: use XDG recommended paths as the defaults for the config and local directories
This commit is contained in:
parent
90fc3d78e0
commit
3075585d9d
2 changed files with 56 additions and 17 deletions
|
|
@ -17,6 +17,9 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os.path
|
||||
from xdg import BaseDirectory
|
||||
|
||||
|
||||
class Const(object):
|
||||
APP_NAME = u'Salut à Toi'
|
||||
|
|
@ -25,10 +28,23 @@ class Const(object):
|
|||
APP_VERSION = u'0.4.1D' # Please add 'D' at the end for dev versions
|
||||
|
||||
DEFAULT_CONFIG = {
|
||||
'local_dir': '~/.sat',
|
||||
'media_dir': '/usr/share/sat/media',
|
||||
'pid_dir': '/tmp',
|
||||
'log_dir': BaseDirectory.save_data_path('sat'),
|
||||
}
|
||||
|
||||
# XXX: tmp update code, will be removed in the future
|
||||
# When you remove this, please add that in DEFAULT_CONFIG:
|
||||
# 'local_dir': BaseDirectory.save_data_path('sat'),
|
||||
# and also remove sat.memory.memory.Memory.__fixLocalDir
|
||||
DEFAULT_LOCAL_DIR = BaseDirectory.save_data_path('sat')
|
||||
|
||||
# List of the configuration filenames sorted by ascending priority
|
||||
CONFIG_FILES = [(os.path.expanduser(path) + 'sat.conf') for path in \
|
||||
['/etc/', '~/', '~/.', '', '.'] + \
|
||||
['%s/' % path for path in list(BaseDirectory.load_config_paths('sat'))]
|
||||
]
|
||||
|
||||
NO_SECURITY_LIMIT = -1
|
||||
INDIVIDUAL = "individual"
|
||||
GENERAL = "general"
|
||||
|
|
|
|||
|
|
@ -97,11 +97,6 @@ class SAT(service.Service):
|
|||
self.plugins = {}
|
||||
|
||||
self.memory = Memory(self)
|
||||
|
||||
local_dir = self.memory.getConfig('', 'local_dir')
|
||||
if not os.path.exists(local_dir):
|
||||
os.makedirs(local_dir)
|
||||
|
||||
self.trigger = TriggerManager() # trigger are used to change SàT behaviour
|
||||
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue