예제 #1
0
 @NotNull
 private static String normalizeRootUrl(
     @NotNull String basePath, @NotNull NewVirtualFileSystem fs) {
   // need to protect against relative path of the form "/x/../y"
   return UriUtil.trimTrailingSlashes(
       fs.getProtocol()
           + URLUtil.SCHEME_SEPARATOR
           + VfsImplUtil.normalize(fs, FileUtil.toCanonicalPath(basePath)));
 }
 @NotNull
 private String findPresetHttpUrl() {
   return ObjectUtils.chooseNotNull(
       ContainerUtil.find(
           myUrlsFromCommand,
           url -> {
             String scheme = UriUtil.splitScheme(url).getFirst();
             return scheme.startsWith("http");
           }),
       ContainerUtil.getFirstItem(myUrlsFromCommand));
 }
 /**
  * Makes the password database key for the URL: inserts the login after the scheme:
  * http://login@url.
  */
 @NotNull
 private static String makeKey(@NotNull String url, @Nullable String login) {
   if (login == null) {
     return url;
   }
   Couple<String> pair = UriUtil.splitScheme(url);
   String scheme = pair.getFirst();
   if (!StringUtil.isEmpty(scheme)) {
     return scheme + URLUtil.SCHEME_SEPARATOR + login + "@" + pair.getSecond();
   }
   return login + "@" + url;
 }