コード例 #1
0
ファイル: ensure_misc.py プロジェクト: zielmicha/init.xyz
def symlink(src, dst):
    try:
        if readlink(expanduser(dst)) == expanduser(src):
            return
    except OSError:
        pass
        
    _symlink(expanduser(src), expanduser(dst))
コード例 #2
0
def symlink(src, dst):
    """
    Extended "os.symlink" that:
    - Autodetect if target is directory.
    - Ignore error if file already exists.
    - Ensure to link to real absolute path of the source.

    Args:
        src (path-like object): Source path.
        dst (path-like object): Destination path.
    """
    src = _realpath(_fsdecode(src))
    try:
        _symlink(src, _fsdecode(dst), target_is_directory=_isdir(src))
    except FileExistsError:
        pass
コード例 #3
0
ファイル: md.py プロジェクト: ExpHP/vaspmd
def symlink(src, dest):
	from os import symlink as _symlink, unlink
	if exists(dest):
		unlink(dest)
	_symlink(src, dest)
コード例 #4
0
 def os_symlink(source, link_name):
   return os._symlink(longpathify(uni(source)), longpathify(uni(link_name)))
コード例 #5
0
 def os_symlink(source, link_name):
     return os._symlink(longpathify(uni(source)),
                        longpathify(uni(link_name)))