/*****************************************************************************/
/* File name: Path.java                                                      */
/* Purpose: some things specific to MS-DOS (and other ms systems maybe too)  */
/* Last modified: 04.12.98                                                   */
/* Author: Victor Klimov, 1998                                               */
/*                                                                           */
/* This program is distributed in the hope that it will be useful, but       */
/* WITHOUT ANY WARRANTY; without even the implied warranty of                */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General */
/* Public License for more details.                                          */
/*                                                                           */
/* This software is distributed under the terms                              */
/* of the GNU General Public License as published                            */
/* by the Free Software Foundation; either version 2, or (at your option)    */
/* any later version.                                                        */
/* See file COPYING for your rights (GNU GPL)                                */
/*****************************************************************************/

package msdos;


final

public
class

Path

{

  private final static String RCSID = "$Header: /d/JTAR03/msdos/RCS/Path.java,v 1.1 1998/12/10 20:40:33 root Exp $";


  Path( )
/*****************************************************************************/
/* Function name: Path                                                       */
/* File name: Path.java                                                      */
/* Purpose: constructor for the object Path                                  */
/* Parameters:                                                               */
/* Returns:                                                                  */
/* Last modified: 26.11.98                                                   */
/* Author: Victor Klimov, 1998                                               */
/*****************************************************************************/
    {
                                                       /* Path */
/*---------------------------------------------------------------------------*/

    }
/*end of Path*/


  public
  static
  StringBuffer
  removeDriveSpecificationPrefix( StringBuffer inStringBuffer )
/*****************************************************************************/
/* Function name: removeDriveSpecificationPrefix                             */
/* File name: Path.java                                                      */
/* Purpose: to remove the drive specification prefix (a letter + ':')        */
/*          from the path StringBuffer                                       */
/* Parameters: inStringBuffer                                                */
/* Returns: the path                                                         */
/* Last modified: 04.12.98                                                   */
/* Author: Victor Klimov, 1998                                               */
/*****************************************************************************/
    {
      Character driveLetter;
      int lengthInStringBuffer;

                                      /* removeDriveSpecificationPrefix */
/*---------------------------------------------------------------------------*/

      if ( ! msdos.System.isMs() )
        return inStringBuffer;                         /* return ! */
      else
        ;
    /*end of if*/

      driveLetter = new
        Character( inStringBuffer.charAt(
                     msdos.Constants.
                       DRIVE_LETTER_NUM_IN_PATH) );

      if ( !driveLetter.isLetter(
              driveLetter.charValue() )
         )
        return inStringBuffer;                         /* return ! */
      else
        ;
    /*end of if*/

      if ( inStringBuffer.charAt(
             msdos.Constants.
               DRIVE_SPEC_SEPARATOR_NUM_IN_PATH ) !=
           msdos.Constants.
             DRIVE_SPEC_SEPARATOR_CHAR   )
        return inStringBuffer;                         /* return ! */
      else
        ;
    /*end of if*/

      inStringBuffer =
        inStringBuffer.reverse();

      lengthInStringBuffer =
        inStringBuffer.length();
      inStringBuffer.
        setLength(
          lengthInStringBuffer -
          msdos.Constants.
            DRIVE_SPEC_SEPARATOR_NUM_IN_PATH - 1 );

      inStringBuffer =
        inStringBuffer.reverse();

      return inStringBuffer;

    }
/*end of removeDriveSpecificationPrefix*/



  public
  static
  void

  main( String[] args )
/*****************************************************************************/
/* Function name: main                                                       */
/* File name: Path.java                                                      */
/* Purpose: to test the Path class                                           */
/* Parameters:                                                               */
/* Returns:                                                                  */
/* Last modified: 26.11.98                                                   */
/* Author: Victor Klimov, 1998                                               */
/*****************************************************************************/
    {
                                                         /* main */
/*---------------------------------------------------------------------------*/

    }
/*end of main*/

} /*end of Path */

/*****************************************************************************/
/* End of file: Path.java                                                   */
/*****************************************************************************/
