From 107656beb230659c30444b757832871eef8ccaa3 Mon Sep 17 00:00:00 2001 From: Jacob Appelbaum Date: Fri, 25 Dec 2009 23:52:03 +0200 Subject: [PATCH] Create a cache directory if missing --- blockfinder | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/blockfinder b/blockfinder index dd0afb5..3e4c03f 100755 --- a/blockfinder +++ b/blockfinder @@ -57,6 +57,15 @@ def fetch_delegation(delegation_url): def cache_delegation(delegation_url, cache_dir): try: + os.stat(cache_dir) + except: + if verbose: + print "Initializing the cache directory..." + try: + os.mkdir(cache_dir) + except: + print "Unable to initialize cache directory. Sorry!" + try: delegation = "" print "Fetching " + delegation_url delegation = fetch_delegation(delegation_url) @@ -134,6 +143,7 @@ def main(): output = None verbose = False silent = True + # XXX TODO: Perhaps we'd rather expand this to be in the users '~'? cache_dir = "/var/tmp/delegation-data/" update_delegations = False delegation_urls=""" -- 2.11.4.GIT