Create upload folder if it does not exist
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
from dotenv import load_dotenv
|
||||
@ -28,6 +29,9 @@ class Settings:
|
||||
except KeyError:
|
||||
sys.exit("discord-embed: Environment variable 'UPLOAD_FOLDER' is missing!")
|
||||
|
||||
# Create upload_folder if it doesn't exist.
|
||||
pathlib.Path(upload_folder).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# We check if the upload folder ends with a forward slash. If it does, we remove it.
|
||||
if upload_folder.endswith("/"):
|
||||
upload_folder = upload_folder[:-1]
|
||||
|
Reference in New Issue
Block a user