Browse Source

Make config directory if it doesn't already exist (#63)

tags/v0.2
Ben Kurtovic 8 years ago
parent
commit
f974cdf409
2 changed files with 3 additions and 2 deletions
  1. +1
    -1
      docs/installation.rst
  2. +2
    -1
      earwigbot/config/script.py

+ 1
- 1
docs/installation.rst View File

@@ -54,5 +54,5 @@ features (``feature/*`` branches)::
.. _earwigbot-plugins: https://github.com/earwig/earwigbot-plugins .. _earwigbot-plugins: https://github.com/earwig/earwigbot-plugins
.. _Python Package Index: http://pypi.python.org .. _Python Package Index: http://pypi.python.org
.. _get pip: http://pypi.python.org/pypi/pip .. _get pip: http://pypi.python.org/pypi/pip
.. _this StackOverflow post: http://stackoverflow.com/questions/6504810/how-to-install-lxml-on-ubuntu/6504860#6504860
.. _this StackOverflow post: http://stackoverflow.com/questions/6504810/how-to-install-lxml-on-ubuntu/6504860#6504860
.. _git flow: http://nvie.com/posts/a-successful-git-branching-model/ .. _git flow: http://nvie.com/posts/a-successful-git-branching-model/

+ 2
- 1
earwigbot/config/script.py View File

@@ -23,7 +23,7 @@
from collections import OrderedDict from collections import OrderedDict
from getpass import getpass from getpass import getpass
from hashlib import sha256 from hashlib import sha256
from os import chmod, mkdir, path
from os import chmod, makedirs, mkdir, path
import re import re
import stat import stat
import sys import sys
@@ -441,6 +441,7 @@ class ConfigScript(object):
def make_new(self): def make_new(self):
"""Make a new config file based on the user's input.""" """Make a new config file based on the user's input."""
try: try:
makedirs(path.dirname(self.config.path))
open(self.config.path, "w").close() open(self.config.path, "w").close()
chmod(self.config.path, stat.S_IRUSR|stat.S_IWUSR) chmod(self.config.path, stat.S_IRUSR|stat.S_IWUSR)
except IOError: except IOError:


Loading…
Cancel
Save