Converts all instances of '\' or '/' to the system directory separator.
507332
private function normalizePaths()
    {
        foreach ($this->paths as $key => $path) {
            $this->paths[$key] = $this->normalizePath($path);
        }
    }
726112
def subdir_findall(dir, subdir):
    
    strip_n = len(dir.split('/'))
    path = '/'.join((dir, subdir))
    return ['/'.join(s.split('/')[strip_n:]) for s in setuptools.findall(path)]
1333172
def splitroot(self, path, sep=None):
        """"""
        if sep is None:
            sep = self.filesystem.path_separator
        if self.filesystem.is_windows_fs:
            return self._splitroot_with_drive(path, sep)
        return self._splitroot_posix(path, sep)
159824
function normalizeManifestPaths (tokensByFile, rootDir) {
  var output = {};
  var rootDirLength = rootDir.length + 1;

  Object.keys(tokensByFile).forEach(function (filename) {
    var normalizedFilename = filename.substr(rootDirLength);
    output[normalizedFilename] = tokensByFile[filename];
  });

  return output;
}
523425
def do_ls(self, nothing = ''):
        """"""
        for d in self.dirs:
            self.stdout.write("\033[0;34m" + ('%s\n' % d) + "\033[0m")

        for f in self.files:
            self.stdout.write('%s\n' % f)
710117
def mkdirs(filename, mode=0o777):
    """"""
    dirname = os.path.dirname(filename)
    if not dirname:
        return
    _compat.makedirs(dirname, mode=mode, exist_ok=True)
420950
def to_existing_absolute_path(string):
    """"""
    value = os.path.abspath(string)
    if not os.path.exists( value ) or not os.path.isdir( value ):
        msg = '"%r" is not a valid path to a directory.' % string
        raise argparse.ArgumentTypeError(msg)
    return value
1030545
protected function _normalizePaths()
    {
        foreach ($this->_paths as &$path) {
            $ds = DIRECTORY_SEPARATOR;
            $path = $this->_normalizePath($path, $ds);
            $path = rtrim($path, $ds) . $ds;
        }
    }
1158189
def paths_for_shell(paths, separator=' '):
    
    paths = filter(None, paths)
    paths = map(shlex.quote, paths)
    if separator is None:
        return paths
    return separator.join(paths)
951560
private String removeTrailingFolderSeparator(String folder) {
		if (folder.endsWith("/") || folder.endsWith("\\")) { 
			folder = folder.substring(0, folder.length() - 1);
		}
		return folder;
	}
786986
public static String separatorsToSystem(String path) {
		if (path == null) {
			return null;
		}
		if (EnvUtil.isWindows()) {
			return separatorsToWindows(path);
		} else {
			return separatorsToUnix(path);
		}
	}
561309
def PrepareMatches(self, file_system):
    
    if self._location is not None:
      self._location_segments = self._SplitPath(
          self._location, file_system.PATH_SEPARATOR)

    elif self._location_regex is not None:
      path_separator = file_system.PATH_SEPARATOR
      if path_separator == '\\':
        # The backslash '\' is escaped within a regular expression.
        path_separator = '\\\\'

      self._location_segments = self._SplitPath(
          self._location_regex, path_separator)

    if self._location_segments is not None:
      self._number_of_location_segments = len(self._location_segments)
831635
private String convertToRelative(String srcFile, String base) {
        String slash = SystemProperties.getProperty("file.separator");

        if (FILE_IGNORE_CASE) {
            srcFile = srcFile.toLowerCase();
            base = base.toLowerCase();
        }

        if (base.equals(srcFile)) {
            return ".";
        }

        if (!base.endsWith(slash)) {
            base = base + slash;
        }

        if (base.length() <= srcFile.length()) {
            String root = srcFile.substring(0, base.length());
            if (root.equals(base)) {
                // Strip off the base directory, make relative
                return "." + SystemProperties.getProperty("file.separator") + srcFile.substring(base.length());
            }
        }

        // See if we can build a relative path above the base using .. notation
        int slashPos = srcFile.indexOf(slash);
        int branchPoint;
        if (slashPos >= 0) {
            String subPath = srcFile.substring(0, slashPos);
            if ((subPath.length() == 0) || base.startsWith(subPath)) {
                branchPoint = slashPos + 1;
                slashPos = srcFile.indexOf(slash, branchPoint);
                while (slashPos >= 0) {
                    subPath = srcFile.substring(0, slashPos);
                    if (base.startsWith(subPath)) {
                        branchPoint = slashPos + 1;
                    } else {
                        break;
                    }
                    slashPos = srcFile.indexOf(slash, branchPoint);
                }

                int slashCount = 0;
                slashPos = base.indexOf(slash, branchPoint);
                while (slashPos >= 0) {
                    slashCount++;
                    slashPos = base.indexOf(slash, slashPos + 1);
                }

                StringBuilder path = new StringBuilder();
                String upDir = ".." + slash;
                for (int i = 0; i < slashCount; i++) {
                    path.append(upDir);
                }
                path.append(srcFile.substring(branchPoint));
                return path.toString();
            }
        }
        return srcFile;
    }
980519
private static String escapeFileSeparatorChar(String fname)
  {
    if (File.separatorChar == '\\')
    {
      return fname.replaceAll(File.separator + File.separator, "_");
    }
    else
    {
      return fname.replaceAll(File.separator, "_");
    }
  }
851381
def parts(self):
        
        parts = self.split(os.path.sep)
        parts[0] = parts[0] and parts[0] or '/'
        return parts
1051393
function normalizePath(dir) {
  if(dir && dir[dir.length - 1] != path.sep) {
    dir += path.sep;
  }
  return dir;
}
352765
private static String cleanSystemId(final String sysId)
    {
        int ix = sysId.indexOf('|');
        if (ix > 0 && URI_WINDOWS_FILE_PATTERN.matcher(sysId).matches()) {
            StringBuilder sb = new StringBuilder(sysId);
            sb.setCharAt(ix, ':');
            return sb.toString();
        }
        return sysId;
    }