Skip to content

Commit

Permalink
feat: cd to DATA_DIR/workdir on tgpy start
Browse files Browse the repository at this point in the history
  • Loading branch information
vanutp committed Apr 20, 2024
1 parent 7e9d683 commit f51dc84
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tgpy/api/directories.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import appdirs

if env_tgpy_data := os.getenv('TGPY_DATA'):
DATA_DIR = Path(env_tgpy_data)
DATA_DIR = Path(env_tgpy_data).absolute()
else:
# noinspection PyTypeChecker
DATA_DIR = Path(appdirs.user_config_dir('tgpy', appauthor=False))
Expand Down
3 changes: 2 additions & 1 deletion tgpy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from tgpy import app
from tgpy._handlers import add_handlers
from tgpy.api import DATA_DIR, MODULES_DIR, config
from tgpy.api import DATA_DIR, MODULES_DIR, WORKDIR, config
from tgpy.modules import run_modules, serialize_module
from tgpy.utils import SESSION_FILENAME, create_config_dirs

Expand Down Expand Up @@ -158,6 +158,7 @@ def migrate_config():

async def _async_main():
create_config_dirs()
os.chdir(WORKDIR)
migrate_hooks_to_modules()

config.load()
Expand Down

0 comments on commit f51dc84

Please sign in to comment.