Revise output path

@param path the output path
@return revised path
769116
public static String revisePath(String path) {
        if (!path.trim().equals("")) {
//            path = path.replaceAll("/", File.separator);
            File f = new File(path);
            if (f != null && !f.exists()) {
                f.mkdirs();
            }
            if (!f.isDirectory()) {
                f = f.getParentFile();
                path = f.getPath();
            }
            if (!path.endsWith(File.separator)) {
                path += File.separator;
            }
        }
        return path;
    }
478680
public function setOutputPath($path) {
		$dir = pathinfo($path, PATHINFO_DIRNAME);
		$dir = $this->normalizePath($dir);
		
		if (! is_dir($dir)) {
			throw new InvalidPath('Invalid directory: "' . $dir . '"');
		}
		
		if (! is_writable($dir)) {
			throw new InvalidPath('The directory: "' . $dir . '" is unwritable');
		}
		
		if (is_file($path) && ! is_writable($path)) {
			throw new InvalidPath('The File "' . $path . '" exists. but unwritable');
		}
		
		$this->outputFile = $dir . DIRECTORY_SEPARATOR . pathinfo($path, PATHINFO_BASENAME);
		
		return $this;
	}
349808
public void setPath(String path)
    {
        if (getState() != __MSG_EDITABLE) throw new IllegalStateException("Not EDITABLE");
        if (_uri == null)
            _uri = new URI(path);
        else
            _uri.setURI(path);
    }
1270031
public static String clean(final String path) {
        return clean(path.replace(WINDOWS_SEPARATOR, UNIX_SEPARATOR), true);
    }
1368373
private String normalizePath(String path) {
		// remove double slashes & backslashes
		path = path.replace("//", "/");
		path = path.replace("\\", "/");

		return path;
	}
1135459
public function setOutputPath($path)
    {
        if (!file_exists($path)) {
            if (!mkdir($path, 0755, true)) {
                throw new BadOutputPathException(
                    sprintf(
                        'Output path %s does not exist and could not be created!',
                        $path
                    ),
                    $path
                );
            }
        } else {
            if (!is_dir($path)) {
                throw new BadOutputPathException(
                    sprintf(
                        'The argument to `output` is expected to the a directory, but got %s!',
                        $path
                    ),
                    $path
                );
            }
        }
        $this->path = $path;
    }
679105
public static Entry<Void> ofDirectory(Revision revision, String path) {
        return new Entry<>(revision, path, EntryType.DIRECTORY, null);
    }
1128830
public void invalidate(@Nullable String path) {
    if (path != null) {
      invalidate(Uri.parse(path));
    }
  }
220303
static String cleanPath( String path ) {

		return path
				.replaceFirst( "^" + ServletRegistrationComponent.REST_CONTEXT + "/", "/" )
				.replaceFirst( "^" + ServletRegistrationComponent.WEBSOCKET_CONTEXT + "/", "/" )
				.replaceFirst( "\\?.*", "" );
	}
222262
public function setOutputPath($path)
    {
        $outpath = $path;
        if (!file_exists($outpath)) {
            if (!mkdir($outpath, 0755, true)) {
                throw new BadOutputPathException(
          sprintf(
            'Output path %s does not exist and could not be created!',
            $outpath
          ),
          $outpath
        );
            }
        } else {
            if (!is_dir(realpath($outpath))) {
                throw new BadOutputPathException(
          sprintf(
            'The argument to `output` is expected to the a directory, but got %s!',
            $outpath
          ),
          $outpath
        );
            }
        }
        $this->outputPath = $outpath;
    }
695099
public static String normalizePath(String path)
  {
    if(File.separatorChar == '/') {
      return path.replace('\\', '/');
    }
    return path.replace('/', '\\');
  }
108139
String withPath(String[] path) {
        StringBuilder sb = new StringBuilder();
        if (path.length > 0) {
            sb.append(" (with path ");
            for (int i = 0; i < path.length - 1; i++) {
                sb.append(path[i]);
                sb.append(".");
            }
            sb.append(path[path.length - 1]);
            sb.append(") ");
        }
        return sb.toString();

    }
1285883
protected void __setOutput(String path) {
        try {
            w_ = new BufferedWriter(new FileWriter(path));
        } catch (Exception e) {
            throw new FastRuntimeException(e.getMessage());
        }
    }
45582
private String createDirectoryPath(String path)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDirectoryPath", "Path="+path);

        StringBuilder directoryPath = new StringBuilder("");

        if ((path != null) && (path.length() > 0))
        {
            // Defect 287722
            // Are we on unix? If so then we need
            // to make sure we replace the first
            // slash if present as it will be
            // removed by the tokenizer.
            if (path.charAt(0) == '/')
            {
                directoryPath.append("/");
            }

            // Are we UNC format? If so then we need
            // to make sure we replace the first
            // two backslashes as they will be
            // removed by the tokenizer.
            if (path.charAt(0) == '\\' && path.charAt(1) == '\\')
            {
                directoryPath.append("\\\\");
            }

            final StringTokenizer tokenizer = new StringTokenizer(path, "\\/");

            while (tokenizer.hasMoreTokens())
            {
                final String pathChunk = tokenizer.nextToken();

                directoryPath.append(pathChunk);

                // Check to see if the directory exists.
                File test = new File(directoryPath.toString());
                if (!test.exists())
                {
                    // Create the directory.
                    test.mkdir();
                }

                if (tokenizer.hasMoreTokens())
                {
                    directoryPath.append(File.separator);
                }
            }
        }

        String retval = directoryPath.toString();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDirectoryPath", retval);
        return retval;
    }
1069882
@Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/list(?<path>(|/.*))$")
    public CompletableFuture<List<EntryDto<?>>> listFiles(@Param("path") String path,
                                                          @Param("revision") @Default("-1") String revision,
                                                          Repository repository) {
        final String normalizedPath = normalizePath(path);
        final Revision normalizedRev = repository.normalizeNow(new Revision(revision));
        final CompletableFuture<List<EntryDto<?>>> future = new CompletableFuture<>();
        listFiles(repository, normalizedPath, normalizedRev, false, future);
        return future;
    }
427495
public Path write(Path path) throws IOException {
        write(Files.newOutputStream(path));
        return path;
    }
114286
public static String clean(String path) {

		path = path.replaceAll("//", "/");
		return StringUtils.trimToNull(path);
	}