diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-12-19 13:40:02 +0000 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-12-19 13:40:02 +0000 |
commit | 45a6869cb46ec07c475fca2fee83e4c906a54e94 (patch) | |
tree | 9714da089fd65cd5820b8f8353fcd244102448b2 /synapse/config/_base.py | |
parent | Merge branch 'hotfixes-v0.5.4' of github.com:matrix-org/synapse (diff) | |
parent | Bump web sdk version to 0.6.0 (diff) | |
download | synapse-45a6869cb46ec07c475fca2fee83e4c906a54e94.tar.xz |
Merge branch 'release-v0.6.0' v0.6.0
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 846570811f..1cdd03e414 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) |