Create a symbolic link (symlink, soft link) to a file

@param src   Path to file or directory
@param path  Path to symbolic link
@return      The {@link LocalCall} object to make the call
420682
public static LocalCall<Boolean> symlink(String src, String path) {
        Map<String, Object> args = new LinkedHashMap<>();
        args.put("src", src);
        args.put("path", path);
        return new LocalCall<>("file.symlink", Optional.empty(), Optional.of(args),
                new TypeToken<Boolean>(){});
    }
1762
def make_symlink(src_path, lnk_path):
    """"""

    # Check for Lustre 60-character symbolic link path bug
    if CHECK_LUSTRE_PATH_LEN:
        src_path = patch_lustre_path(src_path)
        lnk_path = patch_lustre_path(lnk_path)

    # os.symlink will happily make a symlink to a non-existent
    # file, but we don't want that behaviour
    # XXX: Do we want to be doing this?
    if not os.path.exists(src_path):
        return

    try:
        os.symlink(src_path, lnk_path)
    except EnvironmentError as exc:
        if exc.errno != errno.EEXIST:
            raise
        elif not os.path.islink(lnk_path):
            # Warn the user, but do not interrupt the job
            print("Warning: Cannot create symbolic link to {p}; a file named "
                  "{f} already exists.".format(p=src_path, f=lnk_path))
        else:
            # Overwrite any existing symbolic link
            if os.path.realpath(lnk_path) != src_path:
                os.remove(lnk_path)
                os.symlink(src_path, lnk_path)
664869
public static final char getFileTypeLetter(Path path)
    {
        if (Files.isRegularFile(path))
        {
            return '-';
        }
        if (Files.isDirectory(path))
        {
            return 'd';
        }
        if (Files.isSymbolicLink(path))
        {
            return 'l';
        }
        throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link");
    }
1318053
public static synchronized void chdir(String path) {
		if (path != null) {
			rootDir = new File(getAbsolutePath(path)).getAbsolutePath();
		}
	}
23050
def symlink(src, path):
    '''
    
    '''
    path = os.path.expanduser(path)

    try:
        if os.path.normpath(os.readlink(path)) == os.path.normpath(src):
            log.debug('link already in correct state: %s -> %s', path, src)
            return True
    except OSError:
        pass

    if not os.path.isabs(path):
        raise SaltInvocationError('File path must be absolute.')

    try:
        os.symlink(src, path)
        return True
    except (OSError, IOError):
        raise CommandExecutionError('Could not create \'{0}\''.format(path))
    return False
1339117
public static LocalCall<Result> move(String src, String dst) {
        Map<String, Object> args = new LinkedHashMap<>();
        args.put("src", src);
        args.put("dst", dst);
        return new LocalCall<>("file.move", Optional.empty(), Optional.of(args),
                new TypeToken<Result>(){});
    }
98910
protected void addLinkedResource(String path) {
		FilePathMapping linkedResource = getFilePathMapping(path);
		if (linkedResource != null) {
			addLinkedResource(linkedResource);
			if (bundle != null) {
				bundle.getLinkedFilePathMappings()
						.add(new FilePathMapping(bundle, linkedResource.getPath(), linkedResource.getLastModified()));
			}
		}
	}
653104
private RemoteIterator<LocatedFileStatus> methodBasedListPathWithLocation(
      final String src) throws IOException {
    if (namenodeProtocolProxy.isMethodSupported(
        "getLocatedPartialListing", String.class, byte[].class)) {
      return iteratorListing(src);
    } else {
      return arrayListing(src);
    }
  }
720485
private static void createDirectory(Path path) throws IOException {
		try {
			Files.createDirectory(path);
		} catch (FileAlreadyExistsException e) {
			if (!Files.isDirectory(path)) {
				throw e;
			}
		}
	}
1048813
private String buildUrl( String methodPath, CPath path )
    {
        StringBuilder sb = new StringBuilder();

        sb.append( END_POINT ).append( '/' ).append( methodPath );

        if ( path != null ) {
            sb.append( '/' ).append( scope ).append( path.getUrlEncoded() );
        }

        return sb.toString();
    }
295982
public static final FileAttribute<?>[] getDefaultSymbolicLinkFileAttributes(Map<String, ?> env)
    {
        FileAttribute<?>[] attrs = (FileAttribute<?>[]) env.get(DEFAULT_SYMBOLIC_LINK_FILE_ATTRIBUTES);
        if (attrs == null)
        {
            attrs = new FileAttribute<?>[]{
                PosixFilePermissions.asFileAttribute(PosixFilePermissions.fromString("rwxrwxrwx")),
                new FileAttributeImpl(OWNER, new UnixUser("root", 0)),
                new FileAttributeImpl(GROUP, new UnixGroup("root", 0)),
            };
        }
        return attrs;
    }
716292
public void symlinkTo(final String target, final TaskListener listener) throws IOException, InterruptedException {
        act(new SymlinkTo(target, listener));
    }
229928
Supplier<SymbolicLink> symbolicLinkCreator(JimfsPath target) {
    state.checkOpen();
    return factory.symbolicLinkCreator(target);
  }
1101722
private FSDirectory openLuceneDirectory(final File path) {
      try {
         return FSDirectory.open(path.toPath());
      }
      catch (IOException e) {
         throw log.exceptionInCacheLoader(e);
      }
   }
735056
def make_symlink(source, link_path):
    
    if not supports_symlinks():
        dbt.exceptions.system_error('create a symbolic link')

    return os.symlink(source, link_path)
1105399
private File getFileFromPath(final String path) {
        File result = (path != null) ? new File(path) : null;
        // AS7-1752 see if a non-existent relative path exists relative to the home dir
        if (result != null && homeDir != null && !result.exists() && !result.isAbsolute()) {
            File relative = new File(homeDir, path);
            if (relative.exists()) {
                result = relative;
            }
        }
        return result;
    }
942882
def _resolve_symlink(path, max_depth=64):
    '''
    
    '''
    if sys.getwindowsversion().major < 6:
        raise SaltInvocationError('Symlinks are only supported on Windows Vista or later.')

    # make sure we don't get stuck in a symlink loop!
    paths_seen = set((path, ))
    cur_depth = 0
    while is_link(path):
        path = readlink(path)
        if path in paths_seen:
            raise CommandExecutionError('The given path is involved in a symlink loop.')
        paths_seen.add(path)
        cur_depth += 1
        if cur_depth > max_depth:
            raise CommandExecutionError('Too many levels of symbolic links.')

    return path