From adaf4cf768ea26b0460e51fbd2908b276c76ab93 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 11 Mar 2012 12:23:24 +0100 Subject: [PATCH] Make sure ~/.ascii.io dir exists --- bin/asciiio.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/asciiio.py b/bin/asciiio.py index d2329d2..59a59a5 100755 --- a/bin/asciiio.py +++ b/bin/asciiio.py @@ -21,10 +21,10 @@ import ConfigParser import uuid SCRIPT_NAME = os.path.basename(sys.argv[0]) +BASE_DIR = os.path.expanduser("~/.ascii.io") class AsciiCast(object): - BASE_DIR = os.path.expanduser("~/.ascii.io") QUEUE_DIR = BASE_DIR + "/queue" def __init__(self, api_url, user_token, command, title, record_input): @@ -392,6 +392,9 @@ def main(): except ConfigParser.NoOptionError: api_url = 'http://ascii.io' + if not os.path.isdir(BASE_DIR): + os.mkdir(BASE_DIR) + with open(cfg_file, 'wb') as configfile: config.write(configfile)