示例#1
0
  /**
   * --------------------------------------------------------------------------------
   * --------------------------------------------------------------------------------
   * --------------------------------------------------------------------------------
   * -------------------------------------------------------------------------------- Function :
   * PclZipUtilTranslateWinPath() Function : PclZipUtilTranslateWinPath() Description : Description
   * : Translate windows path by replacing '\' by '/' and optionally removing Translate windows path
   * by replacing '\' by '/' and optionally removing drive letter. drive letter. Parameters :
   * Parameters : $p_path : path to translate. $p_path : path to translate. $p_remove_disk_letter :
   * true | false $p_remove_disk_letter : true | false Return Values : Return Values : The path
   * translated. The path translated.
   * --------------------------------------------------------------------------------
   * --------------------------------------------------------------------------------
   */
  public String PclZipUtilTranslateWinPath(String p_path, boolean p_remove_disk_letter) {
    int v_position = 0;

    if (booleanval(Strings.stristr(Options.php_uname(), "windows"))) /*
         * ----- Look for potential disk letter ----- Look for potential disk
         * letter
         *
         * ----- Change potential windows directory separator ----- Change
         * potential windows directory separator
         */ {
      if (p_remove_disk_letter && !equal(v_position = Strings.strpos(p_path, ":"), false)) {
        p_path = Strings.substr(p_path, v_position + 1);
      }

      if ((Strings.strpos(p_path, "\\") > 0) || equal(Strings.substr(p_path, 0, 1), "\\")) {
        p_path = Strings.strtr(p_path, "\\", "/");
      }
    }

    return p_path;
  }