put session files under data folder
This commit is contained in:
parent
847bde3d79
commit
76c84006ad
3 changed files with 9 additions and 5 deletions
|
@ -87,6 +87,11 @@ def main():
|
|||
if args.server:
|
||||
kwargs["server"] = args.server
|
||||
|
||||
if not os.path.isdir('log'):
|
||||
os.mkdir('log')
|
||||
if not os.path.isdir('data'):
|
||||
os.mkdir('data')
|
||||
|
||||
try:
|
||||
client = Treepuncher(
|
||||
args.name,
|
||||
|
|
|
@ -27,8 +27,8 @@ class Storage:
|
|||
|
||||
def __init__(self, name:str):
|
||||
self.name = name
|
||||
init = not os.path.isfile(f"{name}.session")
|
||||
self.db = sqlite3.connect(f'{name}.session')
|
||||
init = not os.path.isfile(name)
|
||||
self.db = sqlite3.connect(name)
|
||||
if init:
|
||||
self._init_db()
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ class Treepuncher(
|
|||
|
||||
self.name = name
|
||||
self.config = ConfigParser()
|
||||
config_path = config_file or f'{self.name}.ini'
|
||||
self.config.read(config_path)
|
||||
self.config.read(config_file or f"{self.name}.ini") # TODO wrap with pathlib
|
||||
|
||||
authenticator : AuthInterface
|
||||
|
||||
|
@ -94,7 +93,7 @@ class Treepuncher(
|
|||
resolve_srv=opt('resolve_srv', default=True, t=bool),
|
||||
)
|
||||
|
||||
self.storage = Storage(self.name)
|
||||
self.storage = Storage(opt('session_file') or f"data/{name}.session") # TODO wrap with pathlib
|
||||
|
||||
self.notifier = Notifier(self)
|
||||
|
||||
|
|
Loading…
Reference in a new issue