# Path: ubelt/util_io.py
# def writeto(fpath, to_write, aslines=False, verbose=None):
# def _ensure_bytes(text):
# def readfrom(fpath, aslines=False, errors='replace', verbose=None):
# def touch(fpath, mode=0o666, dir_fd=None, verbose=0, **kwargs):
# def delete(path, verbose=False):
# 
# Path: ubelt/util_platform.py
# WIN32  = sys.platform == 'win32'  # type: bool
# LINUX  = sys.platform.startswith('linux')  # type: bool
# DARWIN = sys.platform == 'darwin'  # type: bool
# POSIX = 'posix' in sys.builtin_module_names  # type: bool
# def platform_data_dir():
# def platform_config_dir():
# def platform_cache_dir():
# def get_app_data_dir(appname, *args):
# def ensure_app_data_dir(appname, *args):
# def get_app_config_dir(appname, *args):
# def ensure_app_config_dir(appname, *args):
# def get_app_cache_dir(appname, *args):
# def ensure_app_cache_dir(appname, *args):
# def find_exe(name, multi=False, path=None):
# def find_path(name, path=None, exact=False):


from os.path import exists, islink, join, normpath
from ubelt import util_io
from ubelt import util_platform
    from ubelt import _win32_links
    from ubelt import util_colors
import os
import sys
import warnings
        >>> _dirstats(dpath)
        >>> assert not exists(real_path)
    """
    path = normpath(real_path)
    link = normpath(link_path)

    if not os.path.isabs(path):
        # if path is not absolute it must be specified relative to link
        if _can_symlink():
            path = os.path.relpath(path, os.path.dirname(link))
        else:  # nocover
            # On windows, we need to use absolute paths
            path = os.path.abspath(path)

    if verbose:
        print('Symlink: {link} -> {path}'.format(path=path, link=link))
    if islink(link):
        if verbose:
            print('... already exists')
        pointed = _readlink(link)
        if pointed == path:
            if verbose > 1:
                print('... and points to the right place')
            return link
        if verbose > 1:
            if not exists(link):
                print('... but it is broken and points somewhere else: {}'.format(pointed))
            else:
                print('... but it points somewhere else: {}'.format(pointed))
        if overwrite:

# Path: ubelt/util_io.py
# def writeto(fpath, to_write, aslines=False, verbose=None):
# def _ensure_bytes(text):
# def readfrom(fpath, aslines=False, errors='replace', verbose=None):
# def touch(fpath, mode=0o666, dir_fd=None, verbose=0, **kwargs):
# def delete(path, verbose=False):
# 
# Path: ubelt/util_platform.py
# WIN32  = sys.platform == 'win32'  # type: bool
# LINUX  = sys.platform.startswith('linux')  # type: bool
# DARWIN = sys.platform == 'darwin'  # type: bool
# POSIX = 'posix' in sys.builtin_module_names  # type: bool
# def platform_data_dir():
# def platform_config_dir():
# def platform_cache_dir():
# def get_app_data_dir(appname, *args):
# def ensure_app_data_dir(appname, *args):
# def get_app_config_dir(appname, *args):
# def ensure_app_config_dir(appname, *args):
# def get_app_cache_dir(appname, *args):
# def ensure_app_cache_dir(appname, *args):
# def find_exe(name, multi=False, path=None):
# def find_path(name, path=None, exact=False):


# Path: ubelt/util_links.py
from os.path import exists, islink, join, normpath
from ubelt import util_io
from ubelt import util_platform
    from ubelt import _win32_links
    from ubelt import util_colors
import os
import sys
import warnings

        >>> _dirstats(dpath)
        >>> assert not exists(real_path)
    """
    path = normpath(real_path)
    link = normpath(link_path)

    if not os.path.isabs(path):
        # if path is not absolute it must be specified relative to link
        if _can_symlink():
            path = os.path.relpath(path, os.path.dirname(link))
        else:  # nocover
            # On windows, we need to use absolute paths
            path = os.path.abspath(path)

    if verbose:
        print('Symlink: {link} -> {path}'.format(path=path, link=link))
    if islink(link):
        if verbose:
            print('... already exists')
        pointed = _readlink(link)
        if pointed == path:
            if verbose > 1:
                print('... and points to the right place')
            return link
        if verbose > 1:
            if not exists(link):
                print('... but it is broken and points somewhere else: {}'.format(pointed))
            else:
                print('... but it points somewhere else: {}'.format(pointed))
        if overwrite:

            util_io.delete(link, verbose=verbose > 1)