當前位置: 首頁>>代碼示例>>Java>>正文


Java FS.userHome方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.util.FS.userHome方法的典型用法代碼示例。如果您正苦於以下問題:Java FS.userHome方法的具體用法?Java FS.userHome怎麽用?Java FS.userHome使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.util.FS的用法示例。


在下文中一共展示了FS.userHome方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: knownHosts

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private static void knownHosts(final JSch sch, FS fs) throws JSchException {
    final File home = fs.userHome();
    if (home == null)
        return;
    final File known_hosts = new File(new File(home, ".ssh"), "known_hosts"); //$NON-NLS-1$ //$NON-NLS-2$
    try {
        final FileInputStream in = new FileInputStream(known_hosts);
        try {
            sch.setKnownHosts(in);
        } finally {
            in.close();
        }
    } catch (FileNotFoundException none) {
        // Oh well. They don't have a known hosts in home.
    } catch (IOException err) {
        // Oh well. They don't have a known hosts in home.
    }
}
 
開發者ID:Coding,項目名稱:WebIDE-Backend,代碼行數:19,代碼來源:MultiUserSshSessionFactory.java

示例2: getJSch

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
@Override
protected JSch getJSch(OpenSshConfig.Host hc, FS fs) throws JSchException {
    JSch jsch = super.getJSch(hc, fs);

    if (StringUtils.hasValue(passphrase)) {
        // If passphrase is set, add it to identity
        File sshDir = new File(fs.userHome(), ".ssh");
        if (sshDir.isDirectory()) {
            updateIdentity(jsch, new File(sshDir, "identity"));
            updateIdentity(jsch, new File(sshDir, "id_rsa"));
            updateIdentity(jsch, new File(sshDir, "id_dsa"));
        }
    }

    return jsch;
}
 
開發者ID:liveoak-io,項目名稱:liveoak,代碼行數:17,代碼來源:LiveOakSshSessionFactory.java

示例3: identities

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
private static void identities(final JSch sch, FS fs) {
    final File home = fs.userHome();
    if (home == null)
        return;
    final File sshdir = new File(home, ".ssh"); //$NON-NLS-1$
    if (sshdir.isDirectory()) {
        loadIdentity(sch, new File(sshdir, "identity")); //$NON-NLS-1$
        loadIdentity(sch, new File(sshdir, "id_rsa")); //$NON-NLS-1$
        loadIdentity(sch, new File(sshdir, "id_dsa")); //$NON-NLS-1$
    }
}
 
開發者ID:Coding,項目名稱:WebIDE-Backend,代碼行數:12,代碼來源:MultiUserSshSessionFactory.java

示例4: setRepository

import org.eclipse.jgit.util.FS; //導入方法依賴的package包/類
/**
 * Sets the git repository. File path must exist
 * 
 * @param path
 *          - A string that specifies the git Repository folder
 */
public void setRepository(String path) throws IOException {
  File currentRepo = new File(path + "/.git");
  boolean sameOldRepo = git != null && currentRepo.equals(git.getRepository().getDirectory());
  
  // Change the repository only if it is a different one
  if (!sameOldRepo ) {
    if (git != null) {
      // Stop intercepting authentication requests.
      AuthenticationInterceptor.unbind(getHostName());
      git.close();
    }

    git = Git.open(currentRepo);
    // Start intercepting authentication requests.
    AuthenticationInterceptor.bind(getHostName());

    if (logger.isDebugEnabled()) {
      // Debug data for the SSH key load location.
      logger.debug("Java env user home: " + System.getProperty("user.home"));
      logger.debug("Load repository " + path);
      try {
        FS fs = getRepository().getFS();
        if (fs != null) {
          File userHome = fs.userHome();
          logger.debug("User home " + userHome);

          File sshDir = new File(userHome, ".ssh");

          boolean exists = sshDir.exists();
          logger.debug("SSH dir exists " + exists);
          if (exists) {
            File[] listFiles = sshDir.listFiles();
            for (int i = 0; i < listFiles.length; i++) {
              logger.debug("SSH resource path " + listFiles[i]);
            }
          }
        } else {
          logger.debug("Null FS");
        }
      } catch (NoRepositorySelected e) {
        logger.debug(e, e);
      }
    }

    fireRepositoryChanged();
  }
}
 
開發者ID:oxygenxml,項目名稱:oxygen-git-plugin,代碼行數:54,代碼來源:GitAccess.java


注:本文中的org.eclipse.jgit.util.FS.userHome方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。