# 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_path.py
# def augpath(path, suffix='', prefix='', ext=None, tail='', base=None,
#             dpath=None, relative=None, multidot=False):
# def userhome(username=None):
# def shrinkuser(path, home='~'):
# def expandpath(path):
# def ensuredir(dpath, mode=0o1777, verbose=0, recreate=False):
#     def __init__(self):
#     def __del__(self):
#     def ensure(self):
#     def cleanup(self):
#     def start(self):
#     def __enter__(self):
#     def __exit__(self, type_, value, trace):
#     def touch(self, mode=0o666, exist_ok=True):
#     def ensuredir(self, mode=0o777):
#     def expandvars(self):
#     def expand(self):
#     def shrinkuser(self, home='~'):
#     def augment(self, suffix='', prefix='', ext=None, stem=None, dpath=None,
#                 tail='', relative=None, multidot=False):
#     def delete(self):
#     def appdir(cls, appname, *args, type='cache'):
# class TempDir(object):
# class Path(_PathBase):


import os
import warnings
import sys
    import jaraco.windows.filesystem as jwfs
        import shutil
    import re
from os.path import exists
from os.path import join
from ubelt import util_io
from ubelt import util_path
    from ubelt import util_platform
        from ubelt import util_links
            from ubelt import util_links
        from ubelt import util_links
    from ubelt import util_cmd
            from ubelt import util_format
    from ubelt import util_cmd
            from ubelt import util_format
        from os.path import join, isdir, islink
    from ubelt import util_cmd
        from ubelt import util_format
__win32_can_symlink__ = None


def _win32_can_symlink(verbose=0, force=0, testing=0):
    """
    Args:
        verbose (int, default=0): flag
        force (int, default=0): flag
        testing (int, default=0): flag

    Example:
        >>> # xdoctest: +REQUIRES(WIN32)
        >>> import ubelt as ub
        >>> _win32_can_symlink(verbose=1, force=1, testing=1)
    """
    global __win32_can_symlink__
    if verbose:
        print('__win32_can_symlink__ = {!r}'.format(__win32_can_symlink__))
    if __win32_can_symlink__ is not None and not force:
        return __win32_can_symlink__

    tempdir = util_platform.ensure_app_cache_dir('ubelt', '_win32_can_symlink')

    try:
        util_io.delete(tempdir)
    except Exception:
        print('ERROR IN DELETE: sys.platform={}'.format(sys.platform))
        util_links._dirstats(tempdir)
        raise


# 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_path.py
# def augpath(path, suffix='', prefix='', ext=None, tail='', base=None,
#             dpath=None, relative=None, multidot=False):
# def userhome(username=None):
# def shrinkuser(path, home='~'):
# def expandpath(path):
# def ensuredir(dpath, mode=0o1777, verbose=0, recreate=False):
#     def __init__(self):
#     def __del__(self):
#     def ensure(self):
#     def cleanup(self):
#     def start(self):
#     def __enter__(self):
#     def __exit__(self, type_, value, trace):
#     def touch(self, mode=0o666, exist_ok=True):
#     def ensuredir(self, mode=0o777):
#     def expandvars(self):
#     def expand(self):
#     def shrinkuser(self, home='~'):
#     def augment(self, suffix='', prefix='', ext=None, stem=None, dpath=None,
#                 tail='', relative=None, multidot=False):
#     def delete(self):
#     def appdir(cls, appname, *args, type='cache'):
# class TempDir(object):
# class Path(_PathBase):


# Path: ubelt/_win32_links.py
import os
import warnings
import sys
    import jaraco.windows.filesystem as jwfs
        import shutil
    import re
from os.path import exists
from os.path import join
from ubelt import util_io
from ubelt import util_path
    from ubelt import util_platform
        from ubelt import util_links
            from ubelt import util_links
        from ubelt import util_links
    from ubelt import util_cmd
            from ubelt import util_format
    from ubelt import util_cmd
            from ubelt import util_format
        from os.path import join, isdir, islink
    from ubelt import util_cmd
        from ubelt import util_format

__win32_can_symlink__ = None


def _win32_can_symlink(verbose=0, force=0, testing=0):
    """
    Args:
        verbose (int, default=0): flag
        force (int, default=0): flag
        testing (int, default=0): flag

    Example:
        >>> # xdoctest: +REQUIRES(WIN32)
        >>> import ubelt as ub
        >>> _win32_can_symlink(verbose=1, force=1, testing=1)
    """
    global __win32_can_symlink__
    if verbose:
        print('__win32_can_symlink__ = {!r}'.format(__win32_can_symlink__))
    if __win32_can_symlink__ is not None and not force:
        return __win32_can_symlink__

    tempdir = util_platform.ensure_app_cache_dir('ubelt', '_win32_can_symlink')

    try:
        util_io.delete(tempdir)
    except Exception:
        print('ERROR IN DELETE: sys.platform={}'.format(sys.platform))
        util_links._dirstats(tempdir)
        raise


    util_path.ensuredir(tempdir)