diff --git a/core/db.py b/core/db.py index b7e3d5e..e393aa1 100644 --- a/core/db.py +++ b/core/db.py @@ -123,18 +123,13 @@ class Database(Compat): ) ) else: - if os.path.isdir(self.db_location): - self.path = os.path.join(self.db_location, f"{self.name}.sqlite3") - database_uri = f"sqlite:///{self.path}" - self.type = SQLITE - else: + if not os.path.exists(self.db_location): print(f"Creating database directory: {self.db_location}") - if not os.path.exists(self.db_location): - os.makedirs(self.db_location) - # raise NotADirectoryError( - # f"db_location named {self.db_location} was not created" - # f" - please 'mkdir {self.db_location}' and try again" - # ) + os.makedirs(self.db_location) + self.path = os.path.join(self.db_location, f"{self.name}.sqlite3") + database_uri = f"sqlite:///{self.path}" + self.type = SQLITE + self.schema = self.name if self.name.startswith("ext_"): self.schema = self.name[4:] diff --git a/setup.py b/setup.py index 9118fd9..f9069e7 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ entry_points = {"console_scripts": ["cashu = wallet.cashu:cli"]} setuptools.setup( name="cashu", - version="0.1.6", + version="0.1.7", description="Ecash wallet and mint with Bitcoin Lightning support", long_description=long_description, long_description_content_type="text/markdown", diff --git a/wallet/cashu.py b/wallet/cashu.py index 6d301cf..37bf8bf 100755 --- a/wallet/cashu.py +++ b/wallet/cashu.py @@ -5,6 +5,7 @@ import base64 import json import math from functools import wraps +from pathlib import Path import click from bech32 import bech32_decode, bech32_encode, convertbits @@ -45,7 +46,9 @@ def cli( ctx.ensure_object(dict) ctx.obj["HOST"] = host ctx.obj["WALLET_NAME"] = walletname - ctx.obj["WALLET"] = Wallet(ctx.obj["HOST"], f"~/.cashu/{walletname}", walletname) + ctx.obj["WALLET"] = Wallet( + ctx.obj["HOST"], f"{str(Path.home())}/.cashu/{walletname}", walletname + ) pass @@ -87,7 +90,7 @@ async def mint(ctx, amount: int, hash: str): @cli.command("balance", help="See balance.") @click.pass_context @coro -async def receive(ctx): +async def balance(ctx): wallet: Wallet = ctx.obj["WALLET"] await init_wallet(wallet) wallet.status()