コード例 #1
0
ファイル: HelpIO.java プロジェクト: Yaqiang/sextante
  /**
   * Returns the path where help files for a given algorithm are found
   *
   * @param alg the GeoAlgorithm
   * @param bForceCurrentLocale if true, returns the path to the current locale, even if it does not
   *     exist. If false, it will return the path corresponding to the default locale (english) in
   *     case the one corresponding to the current locale does not exist.
   * @return the help path for this algorithm
   */
  public static String getHelpPath(final GeoAlgorithm alg, final boolean bForceLocale) {

    String sPackage = alg.getClass().getPackage().toString();
    sPackage = sPackage.substring(8);
    String sPath =
        SextanteGUI.getHelpPath()
            + File.separator
            + Locale.getDefault().getLanguage()
            + File.separator
            + sPackage;

    final File dir = new File(sPath);
    if (!dir.exists() && !bForceLocale) {
      sPath =
          SextanteGUI.getHelpPath()
              + File.separator
              + Locale.ENGLISH.getLanguage()
              + File.separator
              + sPackage;
    }

    return sPath;
  }