/*
Ensure our symlink is setup correctly
548800
function() {
    // Get the correct filemount
    var filemount = '/code/' + app.env.getEnv('KALABOX_APP_PANTHEON_FILEMOUNT');
    // Force remove the filemount
    return run('rm', ['-rf', filemount], appserverContainer())
    .then(function() {
      return run('ln', ['-nsf', '/media', filemount], appserverContainer());
    });
  }
142154
function link($target, $link)
    {
        $this->files->ensureDirExists(
            $linkPath = $this->sitesPath(), user()
        );

        $this->config->prependPath($linkPath);

        $this->files->symlinkAsUser($target, $linkPath.'/'.$link);

        return $linkPath.'/'.$link;
    }
635988
def symlink(target, link, target_is_directory=False):
	
	target_is_directory = (
		target_is_directory or
		_is_target_a_directory(link, target)
	)
	# normalize the target (MS symlinks don't respect forward slashes)
	target = os.path.normpath(target)
	handle_nonzero_success(
		api.CreateSymbolicLink(link, target, target_is_directory))
1197177
private function ensureSymlink($pathFile)
    {
        if (false === $this->symlinker->hasSymlink($pathFile)) {
            $this->symlinker->symlink($pathFile);
        }
    }
798055
def symlink(source, destination):
    """"""
    log("Symlinking {} as {}".format(source, destination))
    cmd = [
        'ln',
        '-sf',
        source,
        destination,
    ]
    subprocess.check_call(cmd)
1248363
def symlink(self, source, dest):
        
        dest = self._adjust_cwd(dest)
        self._log(DEBUG, 'symlink(%r, %r)' % (source, dest))
        source = bytestring(source)
        self._request(CMD_SYMLINK, source, dest)
951377
private void visit_OP_SYMLINK() throws IOException {
    visitTxId();
    if (!LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitInt(EditsElement.LENGTH);
    }
    v.visitStringUTF8( EditsElement.SOURCE);
    v.visitStringUTF8( EditsElement.DESTINATION);
    if (LayoutVersion.supports(Feature.EDITLOG_OP_OPTIMIZATION, editsVersion)) {
      v.visitLong(EditsElement.MTIME);
      v.visitLong(EditsElement.ATIME);
    } else {
      v.visitStringUTF8(EditsElement.MTIME);
      v.visitStringUTF8(EditsElement.ATIME);
    }
    // PERMISSION_STATUS
    v.visitEnclosingElement(EditsElement.PERMISSION_STATUS);

    v.visitStringText( EditsElement.USERNAME);
    v.visitStringText( EditsElement.GROUPNAME);
    v.visitShort(      EditsElement.FS_PERMISSIONS);

    v.leaveEnclosingElement();
  }
62888
function symlinkAsUser($target, $link)
    {
        if ($this->exists($link)) {
            $this->unlink($link);
        }

        CommandLineFacade::runAsUser('ln -s '.escapeshellarg($target).' '.escapeshellarg($link));
    }
258583
function symlink($target, $link)
    {
        if (!($this->bitmap & SSH2::MASK_LOGIN)) {
            return false;
        }

        //$target = $this->_realpath($target);
        $link = $this->_realpath($link);

        $packet = pack('Na*Na*', strlen($target), $target, strlen($link), $link);
        if (!$this->_send_sftp_packet(NET_SFTP_SYMLINK, $packet)) {
            return false;
        }

        $response = $this->_get_sftp_packet();
        if ($this->packet_type != NET_SFTP_STATUS) {
            user_error('Expected SSH_FXP_STATUS');
            return false;
        }

        if (strlen($response) < 4) {
            return false;
        }
        extract(unpack('Nstatus', $this->_string_shift($response, 4)));
        if ($status != NET_SFTP_STATUS_OK) {
            $this->_logError($response, $status);
            return false;
        }

        return true;
    }
104177
function setupModule() {

    // Shims

    if(typeof self === 'undefined') {
      global.self = global;
    }

    if(!self.URL) {
      self.URL = self.webkitURL;
    }

    // Make sure are on https in browser,
    // otherwise crypto etc. wont work.

    if(isBrowser() &&
        self.location.protocol === 'http:' &&
        self.location.hostname !== 'localhost' &&
        !self.location.hostname.startsWith('192.168.')) {
      self.location.href = self.location.href.replace(/http/, 'https');
    }

    // Setup / export module

    da = self.direape || {};

    if(typeof module === 'undefined') {
      self.direape = da;
    } else {
      module.exports = da;
    }

    da.test = test;

    // Define name of testsuite

    testSuite('direape');
  }
1329403
def _is_symlink(self):
        # type: () -> bool
        '''
        
        '''
        return len(self.dr_entries.sl_records) > 0 or len(self.ce_entries.sl_records) > 0
1313025
protected function doCreateSymlink() {
    $symlink = $this->getInstallationDirectory() . '/' . $this->getProjectName();
    $this->write('Symlink project at <comment>%s</comment>', $this->shortenDirectory($symlink));
    $this->fs->relativeSymlink($this->getProjectDirectory(), $symlink);
  }
879240
def fix_local_scheme(home_dir, symlink=True):
    
    try:
        import sysconfig
    except ImportError:
        pass
    else:
        if sysconfig._get_default_scheme() == 'posix_local':
            local_path = os.path.join(home_dir, 'local')
            if not os.path.exists(local_path):
                os.mkdir(local_path)
                for subdir_name in os.listdir(home_dir):
                    if subdir_name == 'local':
                        continue
                    copyfile(os.path.abspath(os.path.join(home_dir, subdir_name)), \
                                                            os.path.join(local_path, subdir_name), symlink)
588109
def symlink(self, source, dest):
        
        dest = self._adjust_cwd(dest)
        self._log(DEBUG, "symlink({!r}, {!r})".format(source, dest))
        source = b(source)
        self._request(CMD_SYMLINK, source, dest)
106451
function() {

        var _this = this;
        return QFS.statLink(this.getPath())
            .fail(function() {
                return false;
            })
            .then(function(stat) {

                if (!stat) return;

                /* jshint -W109 */
                if (!stat.isSymbolicLink()) {
                    return Q.reject(UTIL.format("SymlinkLibraryNode: Path '%s' is exists and is not a symbolic link",
                        _this.getPath()));
                }
                /* jshint +W109 */

                return QFS.remove(_this.getPath());

            })
            .then(function() {

                var parent = PATH.dirname(_this.getPath());
                return QFS.exists(parent)
                    .then(function(exists) {

                        /* jshint -W109 */
                        if(!exists) {
                            LOGGER.verbose("SymlinkLibraryNode: Creating parent directory for target '%s'",
                                _this.getPath());
                            return QFS.makeTree(parent);
                        }
                        /* jshint +W109 */

                    });

            })
            .then(function() {
                return QFS.symbolicLink(_this.getPath(), _this.relative);
            });

    }
769092
def symlink(self, source, dest):
        
        dest = self._adjust_cwd(dest)
        self._log(DEBUG, 'symlink(%r, %r)' % (source, dest))
        if type(source) is unicode:
            source = source.encode('utf-8')
        self._request(CMD_SYMLINK, source, dest)
1193814
def _symlink_check(name, target, force, user, group, win_owner):
    '''
    
    '''
    changes = {}
    if not os.path.exists(name) and not __salt__['file.is_link'](name):
        changes['new'] = name
        return None, 'Symlink {0} to {1} is set for creation'.format(
            name, target
        ), changes
    if __salt__['file.is_link'](name):
        if __salt__['file.readlink'](name) != target:
            changes['change'] = name
            return None, 'Link {0} target is set to be changed to {1}'.format(
                name, target
            ), changes
        else:
            result = True
            msg = 'The symlink {0} is present'.format(name)
            if not _check_symlink_ownership(name, user, group, win_owner):
                result = None
                changes['ownership'] = '{0}:{1}'.format(*_get_symlink_ownership(name))
                msg += (
                    ', but the ownership of the symlink would be changed '
                    'from {2}:{3} to {0}:{1}'
                ).format(user, group, *_get_symlink_ownership(name))
            return result, msg, changes
    else:
        if force:
            return None, ('The file or directory {0} is set for removal to '
                          'make way for a new symlink targeting {1}'
                          .format(name, target)), changes
        return False, ('File or directory exists where the symlink {0} '
                       'should be. Did you mean to use force?'.format(name)), changes