Skip to content

Commit

Permalink
Create config directory when not present
Browse files Browse the repository at this point in the history
The code to create the directory used by the configuration file was
accidentally removed in the last release, but is now reinstated.

fixes #481
  • Loading branch information
edsu committed Jun 14, 2021
1 parent 1284de4 commit 0c73273
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions twarc/command2.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ def configure(ctx):
config_file = config_provider.file_path
logging.info('creating config file: %s', config_file)

config_dir = pathlib.Path(config_file).parent
if not config_dir.is_dir():
logging.info('creating config directory: %s', config_dir)
config_dir.mkdir(parents=True)

keys = handshake()
if keys is None:
raise click.ClickException("Unable to authenticate")
Expand Down Expand Up @@ -686,12 +691,3 @@ def _error_str(errors):
def _write(results, outfile, pretty=False):
indent = 2 if pretty else None
click.echo(json.dumps(results, indent=indent), file=outfile)

"""
def _get_config_file():
config_dir = pathlib.Path(click.get_app_dir('twarc'))
if not config_dir.is_dir():
config_dir.mkdir(parents=True)
config_file = config_dir / 'config'
return config_file
"""
2 changes: 1 addition & 1 deletion twarc/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = '2.1.6'
version = '2.1.7'

0 comments on commit 0c73273

Please sign in to comment.