Transform path from relative oldBase to newBase.
<p>
If oldBase = /a/b and newBase = /q/w/e then path /a/b/c/d will
transform to /q/w/e/c/d
@param oldBase
@param newBase
@param path
@return
350122
public static final Path transform(Path oldBase, Path newBase, Path path)
    {
        if (!path.startsWith(oldBase))
        {
            throw new IllegalArgumentException(path+" not in "+oldBase);
        }
        return newBase.resolve(oldBase.relativize(path));
    }
673205
private String getBasePath(String path1, String path2) {

        StringBuffer base = new StringBuffer();
        path1 = path1.replace('\\', '/');
        path2 = path2.replace('\\', '/');

        String[] parts1 = path1.split("/");
        String[] parts2 = path2.split("/");

        for (int i = 0; i < parts1.length; i++) {
            if (i >= parts2.length) {
                break;
            }
            if (parts1[i].equals(parts2[i])) {
                base.append(parts1[i] + "/");
            }
        }

        return base.toString();
    }
35220
@SuppressWarnings("unchecked")
    public <A> SimplePath<A> get(Path<A> path) {
        SimplePath<A> newPath = getSimple(toString(path), (Class<A>) path.getType());
        return addMetadataOf(newPath, path);
    }
1144274
B append(BasePath<B> path) {
    ImmutableList.Builder<String> components = ImmutableList.builder();
    components.addAll(this.getSegments());
    components.addAll(path.getSegments());
    return createPathWithSegments(components.build());
  }
522926
public function rename(string $path, string $newpath): bool
    {
        $location       = $this->applyBasePath($path);
        $destination    = $this->applyBasePath($newpath);

        $this->ensureDirectory(dirname($destination));

        return rename($location, $destination);
    }
1350408
public String fixPathInfo(String path)
    {
        if (path == null)
            return null;
        if (path.startsWith("/"))
            path = path.substring(1);   // Resources already start from root/baseURL
        if (baseURL == null)
            if (properties != null)
                if (this.getProperty(BASE_PATH) != null)
                    path = this.getProperty(BASE_PATH) + path;
        return path;
    }
59915
def regeneratePath(path)
      path = File.expand_path(path)
      #puts "SiteRegenerator.regeneratePath, path = #{path}"
      relativePath = Pathname.new(path).relative_path_from(Pathname.new(@baseDir))
      #puts " relativePath = #{relativePath}"
      relativePathComponents = relativePath.to_s.split("/")
      #puts " relativePathComponents = #{relativePathComponents.inspect}"
      subDir = relativePathComponents[0]
      relativeSubDirPathComponents = relativePathComponents[1..-1]
      foundNonCopySubDirectory = false
      for pathComponent in relativeSubDirPathComponents do
        if !foundNonCopySubDirectory && @nonCopySubDirectories.include?(pathComponent)
          puts "NOT COPYING files from #{relativeSubDirPathComponents.join('/')} " + 
            "with non-copy sub-directory #{pathComponent.inspect}"
          foundNonCopySubDirectory = true
        end
      end
      if !foundNonCopySubDirectory
        checkNotSourceOnly(relativeSubDirPathComponents)
        if subDir == @sourceSubDir
          regenerateSubPath(relativeSubDirPathComponents, :source, makeBackups)
        elsif subDir == @outputSubDir
          regenerateSubPath(relativeSubDirPathComponents, :output, makeBackups)
        else
          raise "Path #{path} to regenerate is not contained in #{@sourceSubDir} (source) or #{@outputSubDir} (output) sub-directory of base dir #{@baseDir}"
        end
      end
    end
826673
public static String joinURL(String base, String... paths) throws MalformedURLException {
        StringBuilder result = new StringBuilder(base);
        for (String path : paths) {
            String p = path.replaceFirst("^(\\/)+", "");
            if (result.lastIndexOf("/") != result.length() - 1) {
                result.append('/');
            }
            result.append(p);
        }
        return result.toString();
    }
219842
@InterfaceAudience.Private
    private static String nameOfDatabaseAtPath(String path) {
        String name = FileDirUtils.getDatabaseNameFromPath(path);
        return isWindows() ? name.replace('/', '.') : name.replace('/', ':');
    }
202149
function resolveNewPath(newBase) {
    return mapSync(file => {
      file.cwd += newBase;
      file.base = file.cwd;
      return file;
    });
  }
386271
def resolve_path_from_base(path_to_resolve, base_path):
    
    return os.path.abspath(
        os.path.join(
            base_path,
            os.path.expanduser(path_to_resolve)))
260818
private ArchivePath getNestedPath(ArchivePath fullPath, ArchivePath basePath) {
        final String context = fullPath.get();
        final String baseContent = basePath.get();

        // Remove the base path from the full path
        String nestedArchiveContext = context.substring(baseContent.length());

        return new BasicPath(nestedArchiveContext);
    }
930854
public void updatePath(String path) {
        if (!path.contains(".") && !path.endsWith("/"))
            path += '/';
        this.path = path(path);
    }
861555
public static URI appendPath(URI base, String path) throws URISyntaxException {
    return new URI(base.getScheme(), base.getAuthority(),
        PathUtils.concatPath(base.getPath(), path), base.getQuery(), base.getFragment());
  }
1019219
public FollowPath<T, P> setPath (Path<T, P> path) {
		this.path = path;
		return this;
	}
93502
public void addPath(String path) {
        if (path == null) {
            return;
        }
        String[] pathComponents = path.split("/");
        TrieNode parent = rootNode;
        String part = null;
        if (pathComponents.length <= 1) {
            throw new IllegalArgumentException("Invalid path " + path);
        }
        for (int i=1; i<pathComponents.length; i++) {
            part = pathComponents[i];
            if (parent.getChild(part) == null) {
                parent.addChild(part, new TrieNode(parent));
            }
            parent = parent.getChild(part);
        }
        parent.setProperty(true);
    }
997801
protected void updateBasePath(String basePath) {

        if (m_folderOrName != null) {
            if (m_folderOrName.isName()) {
                m_folderOrName = new CmsContentFolderDescriptor(basePath, m_folderOrName.getFolderName());
            }
        } else {
            m_folderOrName = new CmsContentFolderDescriptor(basePath, m_typeName);
        }
    }