Create a relative repository path for the given artifact coordinates.

@param separator the separator character to use (typically {@code '/'} or {@link File#separatorChar})
@return the path string
4501
public String relativeArtifactPath(char separator) {
        String artifactId1 = getArtifactId();
        String version1 = getVersion();
        StringBuilder builder = new StringBuilder(getGroupId().replace('.', separator));
        builder.append(separator).append(artifactId1).append(separator);
        String pathVersion;
        final Matcher versionMatcher = snapshotPattern.matcher(version1);
        if (versionMatcher.find()) {
            // it's really a snapshot
            pathVersion = version1.substring(0, versionMatcher.start()) + "-SNAPSHOT";
        } else {
            pathVersion = version1;
        }
        builder.append(pathVersion).append(separator).append(artifactId1).append('-').append(version1);
        return builder.toString();
    }
1019738
public static String relativePath(File from, File to) {
        if (from == null || to == null) return null;
        try {
            if (from.isFile()) from = from.getParentFile();
            if (!from.isDirectory()) throw new IllegalArgumentException("Not a directory: " + from);

            final String[] fromParts = from.getCanonicalPath().split(Pattern.quote(File.separator));
            List<String> toParts = new ArrayList<>(asList(to.getCanonicalPath().split(Pattern.quote(File.separator))));

            int skip = 0; // Skip the common base path
            while (skip < fromParts.length && skip < toParts.size() && fromParts[skip].equals(toParts.get(skip))) {
                skip++;
            }
            if (skip > 0) toParts = toParts.subList(skip, toParts.size());

            // Replace each remaining directory in 'from' by a preceding "../"
            for (int i = fromParts.length; i > skip; i--) toParts.add(0, "..");

            // Return the resulting path, joined by seprators.
            return toParts.stream().collect(joining("/"));
        } catch (IOException ioe) {
            throw new IllegalStateException("I/O exception calculating relative path from \""
                    + from + "\" to \"" + to + "\": " + ioe.getMessage(), ioe);
        }
    }
786986
public static String separatorsToSystem(String path) {
		if (path == null) {
			return null;
		}
		if (EnvUtil.isWindows()) {
			return separatorsToWindows(path);
		} else {
			return separatorsToUnix(path);
		}
	}
1011007
@Nullable
  protected String getParentPath(String path) {
    // Root does not have a parent.
    if (isRoot(path)) {
      return null;
    }
    int separatorIndex = path.lastIndexOf(PATH_SEPARATOR);
    if (separatorIndex < 0) {
      return null;
    }
    return path.substring(0, separatorIndex);
  }
634334
public static final Path fromPosix(String posix)
    {
        String path = posix.replace("/", SEP);
        if (OperatingSystem.is(Windows) && path.startsWith("\\"))
        {
            path = "c:"+path;
        }
            
        return Paths.get(path);
    }
707891
@Nonnull
  public CSVParser setSeparatorChar (final char cSeparator)
  {
    if (cSeparator == CCSV.NULL_CHARACTER)
      throw new UnsupportedOperationException ("The separator character must be defined!");
    m_cSeparatorChar = cSeparator;
    if (_anyCharactersAreTheSame ())
      throw new UnsupportedOperationException ("The separator, quote, and escape characters must be different!");
    return this;
  }
166225
public static String asPath(String path) {
        if (path == null) {
            return null;
        }

        // On windows we have to replace the backslash
        if (!File.separator.equals(FileUtil.URI_SEPARATOR_CHAR)) {
            return path.replace(File.separator, FileUtil.URI_SEPARATOR_CHAR);
        } else {
            return path;
        }
    }
448196
public String join(String separator, final String keyValueSeparator) {
		return MapUtil.join(this.map, separator, keyValueSeparator);
	}
150508
public function getPath($separator=' > ', $includeNode=false)
    {
        $path = array();

        $ancestors = $this->getAncestors();
        if($ancestors)
        {
            foreach($ancestors as $ancestor)
            {
                $path[] = $ancestor->getNode()->__toString();
            }
        }

        if($includeNode)
        {
            $path[] = $this->getNode()->__toString();
        }

        return implode($separator, $path);
    }
406559
private String getLevelsPath(final URI rootTemp) {
        final int u = rootTemp.toString().split(URI_SEPARATOR).length - 1;
        if (u == 0) {
            return "";
        }
        final StringBuilder buff = new StringBuilder();
        for (int current = u; current > 0; current--) {
            buff.append("..").append(File.separator);
        }
        return buff.toString();
    }
480438
public String getRelativePath() {
        final StringBuilder builder = new StringBuilder();
        for(final String p : path) {
            builder.append(p).append("/");
        }
        builder.append(getName());
        return builder.toString();
    }
243888
private static String getRelativePathForPath(final String relativePath, final String sep) {
        final StringTokenizer tokenizer = new StringTokenizer(relativePath.replace(WINDOWS_SEPARATOR, UNIX_SEPARATOR), UNIX_SEPARATOR);
        final StringBuilder buffer = new StringBuilder();
        if (tokenizer.countTokens() == 1) {
            return null;
        } else {
            while(tokenizer.countTokens() > 1) {
                tokenizer.nextToken();
                buffer.append("..");
                buffer.append(sep);
            }
            return buffer.toString();
        }
    }
249037
public URI getPath(final org.eclipse.aether.artifact.Artifact artifact) {
        return toUri(pathOf(new DefaultArtifact(artifact.getGroupId(), 
            artifact.getArtifactId(), artifact.getBaseVersion(),
            "", artifact.getExtension(),
            artifact.getClassifier(), new DefaultArtifactHandler(artifact.getExtension()))));
    }
535439
public static String joinWithInnerSeparator(String separator,
                                                Object... collection) {
        StringBuilder b = new StringBuilder();
        boolean first = true;

        for (Object o : collection) {
            if (first) {
                first = false;
            } else {
                b.append(separator);
            }
            b.append(o.toString());
            b.append(separator);
        }
        return b.toString();
    }
1036184
String toGradleArtifactPath(ArtifactCoordinates artifactCoordinates) {
        // e.g.: org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final
        String pathWithMissingClassifier = artifactCoordinates.relativeArtifactPath('/');
        StringBuilder sb = new StringBuilder(pathWithMissingClassifier);

        if (artifactCoordinates.getClassifier() != null && artifactCoordinates.getClassifier().length() > 0) {
            // org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final-wildfly1000
            sb
                    .append("-")
                    .append(artifactCoordinates.getClassifier());
        }

        return sb.toString();
    }
251011
private static String normalizePath(final String path, final String separator) {
        final String p = path.replace(WINDOWS_SEPARATOR, separator).replace(UNIX_SEPARATOR, separator);
        // remove "." from the directory.
        final List<String> dirs = new LinkedList<>();
        final StringTokenizer tokenizer = new StringTokenizer(p, separator);
        while (tokenizer.hasMoreTokens()) {
            final String token = tokenizer.nextToken();
            if (!(".".equals(token))) {
                dirs.add(token);
            }
        }

        // remove ".." and the dir name before it.
        int dirNum = dirs.size();
        int i = 0;
        while (i < dirNum) {
            if (i > 0) {
                final String lastDir = dirs.get(i - 1);
                final String dir = dirs.get(i);
                if ("..".equals(dir) && !("..".equals(lastDir))) {
                    dirs.remove(i);
                    dirs.remove(i - 1);
                    dirNum = dirs.size();
                    i = i - 1;
                    continue;
                }
            }

            i++;
        }

        // restore the directory.
        final StringBuilder buff = new StringBuilder(p.length());
        if (p.startsWith(separator + separator)) {
            buff.append(separator).append(separator);
        } else if (p.startsWith(separator)) {
            buff.append(separator);
        }
        final Iterator<String> iter = dirs.iterator();
        while (iter.hasNext()) {
            buff.append(iter.next());
            if (iter.hasNext()) {
                buff.append(separator);
            }
        }
        if (p.endsWith(separator)) {
            buff.append(separator);
        }

        return buff.toString();
    }
1214319
public static String dirpart(final String path) {
        int s = path.lastIndexOf(File.separatorChar);
        if (s != -1) {
            return path.substring(0, s);
        } else {
            return null;
        } 
    }