import configparser
from pathlib import Path


def get_path_setting(name=''):
    """
    Gets a path specified in the Files section of the settings.ini file.
    :param name: One of the variable names in the FILES section of settings.ini
    :return: Path object from the pathlib library
    """
    config = configparser.ConfigParser()
    config.read('settings.ini')
    try:
        config['PATHS'][name]
    except KeyError:
        print(f'\'{name}\' is not a valid argument for get_path(). Exiting.')
        exit()
    path = Path(config['PATHS'][name])
    if path.exists():
        return path
    else:
        print('The path in settings.ini does not exist on your system. Exiting.')
        exit()