|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2003 Sun * Microsystems, Inc. All Rights Reserved. */ /* * Test_Support.java * */ package org.netbeans.test.gui.web.webmodule.util; import javax.swing.*; import javax.swing.text.*; import java.io.*; /** * */ public class Test_Support extends Object{ static int number = 0; public static boolean deleteDir(String dirname){ File dir = new File(dirname); if (dir.exists()){ String[] progarray = new String[3]; progarray[0] = "rm"; progarray[1] = "-rf"; progarray[2] = dirname; Runtime rt = Runtime.getRuntime(); try{ Process p = rt.exec(progarray); p.waitFor(); System.out.println("after rm dir"); }catch (IOException e) { System.out.println(e); }catch (InterruptedException e) { System.out.println(e); } } return(!dir.exists()); } public static String getTestDir(String testcase){ String workdir = System.getProperty("netbeans.user"); //System.out.println("workdir="+workdir); String dirname = workdir+System.getProperty("file.separator")+testcase; File dir = new File(dirname); if(dir.exists()){ deleteDir(dirname); } boolean succ = dir.mkdir(); if (!succ) System.out.println("Can not mkdir"+dirname); return dirname; } public static void sleep(){ sleep(5000); } public static void sleep(int time){ try{ Thread.sleep(time); }catch (InterruptedException e){ e.printStackTrace(); } } public static boolean isFileExist(String filename){ File dir = new File(filename); return dir.exists(); } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.