Retrieve the path to the dir containing OPTIONS file for a given port

def _options_dir(name):
    '''
    Retrieve the path to the dir containing OPTIONS file for a given port
    '''
    _check_portname(name)
    _root = '/var/db/ports'

    # New path: /var/db/ports/category_portname
    new_dir = os.path.join(_root, name.replace('/', '_'))
    # Old path: /var/db/ports/portname
    old_dir = os.path.join(_root, name.split('/')[-1])

    if os.path.isdir(old_dir):
        return old_dir
    return new_dir