Files
OpenBB/openbb_terminal/core/config/make_paths.py
Om Gupta 3d0190e35b New path for .env (#2508)
* add log path

* add test to check if log file is in correct dir

* env path

* black

* mypy fix

* linting

* add make_paths and change references

* terminal change

* change constants to paths

* change names

* black

* mypy

* mypy

* pylint else

* add make paths

* remove custom user dir name

Co-authored-by: Chavithra <chavithra@gmail.com>
2022-09-12 11:56:45 +01:00

29 lines
690 B
Python

# IMPORTATION STANDARD
import os
from openbb_terminal.core.config.paths import (
SETTINGS_DIRECTORY,
USER_DATA_DIRECTORY,
USER_ENV_FILE,
ENV_FILE_REPOSITORY,
)
def create_paths():
"""
Creates dirs/files for user data and .env files outside the
terminal if they don't exist
"""
if not os.path.exists(SETTINGS_DIRECTORY):
os.mkdir(SETTINGS_DIRECTORY)
if not USER_ENV_FILE.is_file():
with open(str(USER_ENV_FILE), "w"):
pass
if not ENV_FILE_REPOSITORY.is_file():
with open(str(ENV_FILE_REPOSITORY), "w"):
pass
if not os.path.exists(USER_DATA_DIRECTORY):
os.mkdir(USER_DATA_DIRECTORY)