Set base path
Note: This method is not part of the PSR-7 standard
974464
public function withBasePath($basePath)
    {
        if (!is_string($basePath)) {
            throw new InvalidArgumentException('Uri path must be a string');
        }
        if (!empty($basePath)) {
            $basePath = '/' . trim($basePath, '/');
        }
        $clone = clone $this;

        if ($basePath !== '/') {
            $clone->basePath = Validator::checkPath($basePath);
        }

        return $clone;
    }
1295795
@SuppressWarnings({ "rawtypes", "unchecked" })
    public boolean setDocBase(String basePath)
    {
        proxyDirContext = null;
        if (basePath == null)
            return false;
        Hashtable env = new Hashtable();
                    
        File file = new File(basePath);
        if (!file.exists())
            return false;
        if (!file.isDirectory())
            return false;
      
        env.put(ProxyDirContext.CONTEXT, file.getPath());
        FileDirContext fileContext = new FileDirContext(env);
        fileContext.setDocBase(file.getPath());
        proxyDirContext = new ProxyDirContext(env, fileContext);
          /* Can't figure this one out
        InitialContext cx = null;
          try {
              cx.rebind(RESOURCES_JNDI_NAME, obj);
          } catch (NamingException e) {
              e.printStackTrace();
          }
          */
        // Load the proxy dir context.
        return true;
    }
71065
function setRoot(mountpath) {

    // mount to root if not mountpath
    let root=mountpath?mountpath:"";
    // add leading slash if needed
    root=root.match(/^\/.*/)?root:`/${root}`;
    // chop off trailing slash
    root=root.match(/^.*\/$/)?root.substring(0,root.length-1):root; 
    // if root is just slash then mountpath is empty (load on root of site)
    root=root.length>1?root:"";
    return root;
}
752548
public function setBasePath($path)
    {
        if (($this->_basePath = realpath($path)) === false || !is_dir($this->_basePath)) {
            throw new Exception(Mindy::t('base', 'Application base path "{path}" is not a valid directory.', ['{path}' => $path]));
        }
    }
377659
def update_domain_base_path_mapping(self, domain_name, lambda_name, stage, base_path):
        
        api_id = self.get_api_id(lambda_name)
        if not api_id:
            print("Warning! Can't update base path mapping!")
            return
        base_path_mappings = self.apigateway_client.get_base_path_mappings(domainName=domain_name)
        found = False
        for base_path_mapping in base_path_mappings.get('items', []):
            if base_path_mapping['restApiId'] == api_id and base_path_mapping['stage'] == stage:
                found = True
                if base_path_mapping['basePath'] != base_path:
                    self.apigateway_client.update_base_path_mapping(domainName=domain_name,
                                                                    basePath=base_path_mapping['basePath'],
                                                                    patchOperations=[
                                                                        {"op" : "replace",
                                                                         "path" : "/basePath",
                                                                         "value" : '' if base_path is None else base_path}
                                                                    ])
        if not found:
            self.apigateway_client.create_base_path_mapping(
                domainName=domain_name,
                basePath='' if base_path is None else base_path,
                restApiId=api_id,
                stage=stage
            )
377283
public void setNestedPath(final String nestedPath) {
        final String canonicalPath = normalizePath(nestedPath);
        this.nestedPathStack.clear();
        if(canonicalPath.isEmpty()) {
            this.currentPath = buildPath();
        } else {
            pushNestedPath(canonicalPath);
        }
    }
1231531
function(path, base)
        {
            base = base ? base + "/" : "/";
            if(
                !hasProtocol(base, base.substr(0, 2))
            ) {
                base = location.origin + base;
            }
            var url = new URL(path, base);
            path = url.origin + url.pathname;
            path = path.replace(location.origin, "");
            // path = new URL(path, base).href.replace(location.origin, "");
            // if it has a trailing slash i.e. a directory, remove the trailing slash
            var len = path.length - 1;
            return path[len] === "/" ? path.substr(0, len) : path;
        }
998947
public function setBasePath($path)
    {
        $this->basePath = $path;

        array_unshift($this->paths, $this->basePath);
    }
1309462
public function setBasePath($path) {
		$path = rtrim($path, DIRECTORY_SEPARATOR);
		
		if (! file_exists($path) || ! is_dir($path)) {
			throw new ConfigError('Base directory does not exists: "' . $path . '"');
		}
		
		$this->_basePath = $path;
		
		return $this;
	}
1315002
def set_paths(self, base_dir, script_path):
        """"""
        # Make absolute paths #
        if 'change_dir' in self.kwargs:
            self.kwargs['change_dir'] = DirectoryPath(os.path.abspath(self.kwargs['change_dir']))
        if 'out_file' in self.kwargs:
            self.kwargs['out_file']   = FilePath(os.path.abspath(self.kwargs['out_file']))
        # In case there is a base directory #
        if base_dir is not None:
            self.base_dir             = DirectoryPath(os.path.abspath(base_dir))
            self.script_path          = FilePath(base_dir + "run." + self.extensions[self.language])
            self.kwargs['change_dir'] = base_dir
            self.kwargs['out_file']   = FilePath(base_dir + "run.out")
        # Other cases #
        if base_dir is None and script_path is None: self.script_path = FilePath(new_temp_path())
        if script_path is not None: self.script_path = FilePath(os.path.abspath(script_path))
301673
@ConfigArg(0)
  public void setPath(PathImpl path)
  {
    _classDir = path;

    if (_sourceDir == null) {
      _sourceDir = path;
    }
  }
1039605
def _badpath(path, base):
    
    return not _resolved(os.path.join(base, path)).startswith(base)
590511
def BasenamePath(self, path):
    
    if path.endswith(self.PATH_SEPARATOR):
      path = path[:-1]
    _, _, basename = path.rpartition(self.PATH_SEPARATOR)
    return basename
281545
def pathify(basenames, examples_dir="examples/"):  # pragma: no cover
    """"""
    example = examples_dir.replace("/", ".")
    return [example + basename for basename in basenames]
114117
def set_data_path(self, pth):
        
        if os.path.exists(pth):
            if not os.path.exists(os.path.join(pth, 'data', 'geodetic')):
                raise IOError("The given path doesn't contain a 'data' "
                              "subdirectory")
            os.environ["AIPSPATH"] = "%s dummy dummy" % pth
948899
def _to_relative_path(cls, parent_repo, path):
        """"""
        path = to_native_path_linux(path)
        if path.endswith('/'):
            path = path[:-1]
        # END handle trailing slash

        if osp.isabs(path):
            working_tree_linux = to_native_path_linux(parent_repo.working_tree_dir)
            if not path.startswith(working_tree_linux):
                raise ValueError("Submodule checkout path '%s' needs to be within the parents repository at '%s'"
                                 % (working_tree_linux, path))
            path = path[len(working_tree_linux.rstrip('/')) + 1:]
            if not path:
                raise ValueError("Absolute submodule path '%s' didn't yield a valid relative path" % path)
            # end verify converted relative path makes sense
        # end convert to a relative path

        return path
516377
public function setBasePath($basePath = '')
    {
        if (gettype($basePath) === 'string') {
            $this->basePath = $basePath;
        } else {
            $msg = "The basePath argument must be a valid string, '" . gettype($basePath) . "' given.";
            throw new InvalidArgumentException($msg);
        }
    }