def config_dir(mkcustom=False):
    """Returns the configuration directory for custom package settings.
    """
    from acorn.utility import reporoot
    from acorn.base import testmode
    from os import path
    alternate = path.join(path.abspath(path.expanduser('~')), '.acorn')
    if testmode or not path.isdir(alternate) and not mkcustom:
        return path.join(reporoot, 'acorn', 'config')
    else:
        if mkcustom:
            from os import mkdir
            mkdir(alternate)
        return alternate
