diff options
author | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-12-11 18:34:26 +0000 |
---|---|---|
committer | Paul "LeoNerd" Evans <paul@matrix.org> | 2014-12-11 18:34:26 +0000 |
commit | 57b509454527752c2c4153a43294beb65a38a702 (patch) | |
tree | 653fd9ea3b5c339a1ac1abf9f42aeb71d7ad3dd8 /synapse/config/_base.py | |
parent | Avoid cyclic dependency in handler setup (diff) | |
parent | Fix typo in media repository doc string (diff) | |
download | synapse-57b509454527752c2c4153a43294beb65a38a702.tar.xz |
Merge branch 'develop' of github.com:matrix-org/synapse into develop
Diffstat (limited to 'synapse/config/_base.py')
-rw-r--r-- | synapse/config/_base.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/synapse/config/_base.py b/synapse/config/_base.py index 6870af10e8..1426436dcb 100644 --- a/synapse/config/_base.py +++ b/synapse/config/_base.py @@ -50,6 +50,16 @@ class Config(object): ) return cls.abspath(file_path) + @staticmethod + def ensure_directory(dir_path): + if not os.path.exists(dir_path): + os.makedirs(dir_path) + if not os.path.isdir(dir_path): + raise ConfigError( + "%s is not a directory" % (dir_path,) + ) + return dir_path + @classmethod def read_file(cls, file_path, config_name): cls.check_file(file_path, config_name) @@ -57,6 +67,10 @@ class Config(object): return file_stream.read() @staticmethod + def default_path(name): + return os.path.abspath(os.path.join(os.path.curdir, name)) + + @staticmethod def read_config_file(file_path): with open(file_path) as file_stream: return yaml.load(file_stream) |