Add symbolic link to package.
@param target Target path like /opt/application/bin/foo
@param linkTarget Link target like ../lib/bar
@return
@throws IOException
495725
@Override
    public FileBuilder addSymbolicLink(Path target, Path linkTarget) throws IOException
    {
        checkTarget(target);
        checkTarget(linkTarget);
        FileBuilder fb = new FileBuilder();
        fb.target = target;
        fb.linkTo = linkTarget;
        fb.content = ByteBuffer.wrap(PathHelper.posixString(linkTarget).getBytes(US_ASCII));
        fb.size = fb.content.limit();
        fb.mode = (short) 0120000;
        fb.compressFilename();
        fileBuilders.add(fb);
        return fb;
    }
1211154
public Link target(String t)
    {
        if (t!=null && t.length()>0)
            attribute("target",t);
        return this;
    }
1279241
public String getSymbolicLinkTarget(String linkpath)
			throws SftpStatusException, SshException {

		if (version < 3) {
			throw new SftpStatusException(
					SftpStatusException.SSH_FX_OP_UNSUPPORTED,
					"Symbolic links are not supported by the server SFTP version "
							+ String.valueOf(version));
		}

		try {
			UnsignedInteger32 requestId = nextRequestId();
			Packet msg = createPacket();
			msg.write(SSH_FXP_READLINK);
			msg.writeInt(requestId.longValue());
			msg.writeString(linkpath, CHARSET_ENCODING);

			sendMessage(msg);

			SftpFile[] files = extractFiles(getResponse(requestId), null);
			return files[0].getAbsolutePath();
		} catch (SshIOException ex) {
			throw ex.getRealException();
		} catch (IOException ex) {
			throw new SshException(ex);
		}

	}
99371
public final void addTarget(@NotNull final Target target) {
        Contract.requireArgNotNull("target", target);
        if (targets == null) {
            targets = new ArrayList<>();
        }
        targets.add(target);
    }
157620
public function addOrReplaceTarget($targetName, &$target)
    {
        $this->log("  +Target: $targetName", Project::MSG_DEBUG);
        $target->setProject($this);
        $this->targets[$targetName] = $target;

        $ctx = $this->getReference(ProjectConfigurator::PARSING_CONTEXT_REFERENCE);
        $current = $ctx->getCurrentTargets();
        $current[$targetName] = $target;
    }
927752
def symlink(target, link):
    
    if islink(link):
        unlink(link)
    if platform.system() == "Windows":
        if sys.version_info[:2] < (3, 5):
            with open(os.devnull, "w") as nul:
                subprocess.check_call(["mklink", "/J", link, target], shell=True, stdout=nul)
        else:
            _winapi.CreateJunction(target, link)
    else:
        os.symlink(target, link)
1043076
File getTargetDirectory( File sourceFile, File sourceBaseDir, File targetBaseDir )
        throws MojoExecutionException, MojoFailureException
    {
        String filePath;
        String tempPath;
        try
        {
            filePath = sourceFile.getParentFile().getCanonicalPath();
            tempPath = sourceBaseDir.getCanonicalPath();
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Error getting canonical path", e );
        }

        if ( !filePath.startsWith( tempPath ) )
        {
            throw new MojoFailureException( "File " + sourceFile
                + " is expected to be somewhere under the following directory: " + tempPath );
        }

        File targetDir = new File( targetBaseDir, filePath.substring( tempPath.length() ) );
        return targetDir;
    }
1361595
@Override
    public ComponentBuilder addDirectory(String target) throws IOException
    {
        checkTarget(target);
        FileBuilder fb = new FileBuilder(target);
        fileBuilders.add(fb);
        return fb;
    }
1265433
@Override
  public void link(final CCTask task, final File outputFile, final String[] sourceFiles,
      final CommandLineLinkerConfiguration config) {
    //
    // delete any existing library
    outputFile.delete();
    //
    // build a new library
    super.link(task, outputFile, sourceFiles, config);
  }
1197565
@Override
    public T addAsManifestResource(Package resourcePackage, String resourceName, String target)
        throws IllegalArgumentException {
        Validate.notNull(resourcePackage, "ResourcePackage must be specified");
        Validate.notNull(resourceName, "ResourceName must be specified");
        Validate.notNull(target, "Target must be specified");

        return addAsManifestResource(resourcePackage, resourceName, ArchivePaths.create(target));
    }
464239
protected function createLink($source, $target)
    {
        $success = $this->filesystem->relativeSymlink($source, $target);
        if (!$success) {
            throw new RuntimeException("Could not create symlink at $target");
        }
    }
1033217
void createSymbolicLinkTo(final File destinationFolder) throws IOException {
    for (final File f : this.theFiles) {
      final File destinationFile = new File(destinationFolder, f.getName());
      Files.createSymbolicLink(destinationFile.toPath(), f.toPath());
    }
  }
685651
function setupByLink() {
    console.warn("symlink doesn't resolve __dirname.");

    const srcTaskDir = path.join(__dirname, 'tasks');

    // detect target package
    const targets = [];
    const PACKAGES_DIR = path.join(__dirname, '..');
    fs.readdirSync(PACKAGES_DIR)
    .forEach((filePath) => {
        const absPath = path.join(PACKAGES_DIR, filePath);
        if (fs.statSync(absPath).isDirectory()) {
            if (/^cdp-/.test(filePath)) {
                // check project.config.js
                try {
                    const config = require(path.join(absPath, 'project.config'));
                    if (config.required_tasks) {
                        targets.push({
                            path: absPath,
                            required_tasks: config.required_tasks,
                            task_dir: config.dir.task,
                        });
                    }
                } catch (error) {
                    return; // next
                }
            }
        }
    });

    // link
    targets.forEach((target) => {
        const dstTaskDir = path.join(target.path, target.task_dir);
        if (!fs.existsSync(dstTaskDir)) {
            // create tasks dir
            fs.mkdirSync(dstTaskDir);
        }

        target.required_tasks.forEach((task) => {
            const src = path.join(srcTaskDir, task);
            const dst = path.join(dstTaskDir, task);
            if (!fs.existsSync(src)) {
                console.error('task not found: ' + task);
                process.exit(1);
            }
            if (fs.existsSync(dst)) {
                fs.unlinkSync(dst);
            }
            fs.symlinkSync(src, dst, 'file');
        });
    });
}
621928
protected function symlink($targetPath, $link, $logShort = false)
    {
        parent::symlink($targetPath, $link, $logShort);
    }
35242
public Content getTargetModulePackageLink(PackageElement pkg, String target,
            Content label, ModuleElement mdle) {
        return getHyperLink(pathString(pkg, DocPaths.PACKAGE_SUMMARY),
                label, "", target);
    }
1142149
protected function symlink($target, $link, $logShort = false)
    {
        $fs = FileSystem::getFileSystem();

        // Convert target to relative path.
        $absolutePath = (new PhingFile($link))->getAbsolutePath();
        $link         = $absolutePath;

        if ($logShort) {
            $relativePath = str_replace(
                $this->getProject()->getBaseDir(),
                "", $absolutePath
            );
            $linkName     = basename($absolutePath);
        } else {
            $linkName = $link;
        }

        // @codingStandardsIgnoreLine: MULTISITE-17111
        $target = rtrim(
            $this->makePathRelative($target, dirname($link)),
            '/'
        );

        if (is_link($link) && @readlink($link) == $target) {
            $this->log('Link exists: '.$linkName, Project::MSG_INFO);

            return true;
        }

        if (file_exists($link) || is_link($link)) {
            if (!$this->getOverwrite()) {
                $this->log(
                    'Not overwriting existing link '.$link,
                    Project::MSG_ERR
                );

                return false;
            }

            if (is_link($link) || is_file($link)) {
                $fs->unlink($link);
                $this->log(
                    'Link removed: '.$linkName,
                    Project::MSG_INFO
                );
            } else {
                $fs->rmdir($link, true);
                $this->log(
                    'Directory removed: '.$linkName,
                    Project::MSG_INFO
                );
            }
        }

        $this->log('Linking: '.$linkName.' to '.$target, Project::MSG_INFO);

        return $fs->symlink($target, $link);

    }
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()));
			}
		}
	}