private static void doAddDir()

in src/net/sourceforge/transparent/CommandLineClearCase.java [161:190]


  private static void doAddDir( File dir, String comment )
  {
    String ext = Long.toString( new Date().getTime() );

    //  Error message if first rename fails.
    @NonNls String prefix = "Could not rename the content of " + dir.getPath();
    @NonNls String error = prefix + " as part of adding it to ClearCase." + " Please add it manually";

    File tmpDir = new File( dir.getParentFile(), dir.getName() + "." + ext );
    try
    {
      FileUtil.rename( dir, tmpDir );
      try
      {
        doAdd( "mkdir", dir.getAbsolutePath(), comment );
        FileUtil.delete( dir );
      }
      finally
      {
        //  Error message if second rename (back) fails.
        error = prefix + " back as part of adding it to Clearcase:\n" + "Its old content is in the " +
                tmpDir.getName() + ". Please rename it back manually.";
        FileUtil.moveDirWithContent( tmpDir, dir );
      }
    }
    catch( IOException e )
    {
      throw new ClearCaseException( error );
    }
  }