forked from LBRYCommunity/lbry-sdk
create data. download, and wallet directories if they don't exist on startup
This commit is contained in:
parent
478f79353a
commit
ccbe8aa0eb
1 changed files with 9 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
import os
|
||||
import sys
|
||||
import pathlib
|
||||
import json
|
||||
import asyncio
|
||||
import argparse
|
||||
|
@ -216,12 +218,19 @@ def get_argument_parser():
|
|||
return main
|
||||
|
||||
|
||||
def ensure_directory_exists(path: str):
|
||||
if not os.path.isdir(path):
|
||||
pathlib.Path(path).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def main(argv=None):
|
||||
argv = argv or sys.argv[1:]
|
||||
parser = get_argument_parser()
|
||||
args, command_args = parser.parse_known_args(argv)
|
||||
|
||||
conf = Config.create_from_arguments(args)
|
||||
for directory in (conf.data_dir, conf.download_dir, conf.wallet_dir):
|
||||
ensure_directory_exists(directory)
|
||||
|
||||
if args.cli_version:
|
||||
print(f"{lbrynet_name} {lbrynet_version}")
|
||||
|
|
Loading…
Reference in a new issue