UsergeTeam / Userge

Userge, Durable as a Serge
https://userge.tech
GNU General Public License v3.0
676 stars 2.01k forks source link

dclear: allow creating existing dirs #455

Closed yshalsager closed 2 years ago

yshalsager commented 2 years ago

This prevents an exception when mounting downloads directory on host using docker volumes and using dclear command.

      volumes:
        - ./downloads:/app/downloads

Traceback:

PLUGIN : userge.plugins.misc.pathlib
FUNCTION : dclear_
ERROR : [Errno 17] File exists: 'downloads/'

Traceback (most recent call last):
  File "/app/userge/core/methods/decorators/raw_decorator.py", line 327, in template
    await func(types.bound.Message.parse(
  File "/app/userge/plugins/misc/pathlib.py", line 412, in dclear_
    os.makedirs(Config.DOWN_PATH)
  File "/usr/local/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
FileExistsError: [Errno 17] File exists: 'downloads/'
rking32 commented 2 years ago

Thanks :)