commit 92ebf970acb3441f9e78b26d24eb32aa39e95e33 parent b786249da70eeb827438f59804981f86de8f1556 Author: ThomasV <thomasv@electrum.org> Date: Wed, 13 Dec 2017 12:15:26 +0100 Merge pull request #3513 from SomberNight/make_dir_testnet fix: testnet datadir could not be created first Diffstat:
M | lib/simple_config.py | | | 17 | ++++++++++------- |
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/simple_config.py b/lib/simple_config.py @@ -85,15 +85,18 @@ class SimpleConfig(PrintError): if path is None: path = self.user_dir() + def make_dir(path): + # Make directory if it does not yet exist. + if not os.path.exists(path): + if os.path.islink(path): + raise BaseException('Dangling link: ' + path) + os.mkdir(path) + os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) + + make_dir(path) if self.get('testnet'): path = os.path.join(path, 'testnet') - - # Make directory if it does not yet exist. - if not os.path.exists(path): - if os.path.islink(path): - raise BaseException('Dangling link: ' + path) - os.mkdir(path) - os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) + make_dir(path) self.print_error("electrum directory", path) return path