KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > menubuilders > RefreshMenus


1 /*
2  * Created on Mar 4, 2005
3  *
4  */

5 package com.dotmarketing.menubuilders;
6
7 import com.dotmarketing.util.Config;
8
9 /**
10  * @author maria
11  */

12 public class RefreshMenus {
13
14     public static void deleteMenus() {
15
16         String JavaDoc velocityRootPath = Config.getStringProperty("VELOCITY_ROOT");
17         if (velocityRootPath.startsWith("/WEB-INF")) {
18             velocityRootPath = Config.CONTEXT.getRealPath(velocityRootPath);
19         }
20         java.io.File JavaDoc directory = new java.io.File JavaDoc(velocityRootPath + "/static/menus/");
21         
22         if (directory.isDirectory()) {
23             //get all files for this directory
24
java.io.File JavaDoc[] files = directory.listFiles();
25             for (int i = 0; i < files.length; i++) {
26                 //deletes all files on the directory
27
((java.io.File JavaDoc)files[i]).delete();
28             }
29         }
30
31
32     }
33
34 }
35
Popular Tags