KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > utils > RarManagement


1 /*
2  * Created on 9 mars 2004
3  *
4  * To change the template for this generated file go to
5  * Window>Preferences>Java>Code Generation>Code and Comments
6  */

7 package com.bull.eclipse.jonas.utils;
8
9 import java.io.File JavaDoc;
10 import java.io.IOException JavaDoc;
11
12 import org.eclipse.core.resources.IProject;
13 import org.eclipse.core.runtime.IPath;
14
15 import com.bull.eclipse.jonas.JonasLauncherPlugin;
16 import com.bull.eclipse.jonas.JonasProject;
17
18 /**
19  * @author riase
20  *
21  * To change the template for this generated type comment go to
22  * Window>Preferences>Java>Code Generation>Code and Comments
23  */

24 public class RarManagement {
25     
26     static public String JavaDoc[] searchRarInProject(JonasProject prj) {
27         String JavaDoc[] rarDir = null;
28         IPath rarPath = prj.getProject().getLocation().append("resourceAdapter");
29         if (rarPath.toFile().exists()) {
30             rarDir = rarPath.toFile().list();
31         }
32         return rarDir;
33     }
34     
35     static public void buildRarFile(String JavaDoc pathRar, IProject prj) throws IOException JavaDoc {
36         String JavaDoc outputDirectory = prj.getLocation().toOSString() + File.separator + "output" + File.separator + "rars";
37         File JavaDoc pathFile = new File JavaDoc(pathRar);
38         File JavaDoc outputFile = new File JavaDoc(outputDirectory);
39         if (!outputFile.exists())
40             outputFile.mkdirs();
41         Zipper zipper = new Zipper(new File JavaDoc(outputDirectory + File.separator + pathFile.getName() + ".rar"),pathFile);
42         zipper.zip();
43         FileUtil.copy(new File JavaDoc(outputDirectory + File.separator + pathFile.getName() + ".rar"),new File JavaDoc(JonasLauncherPlugin.getDefault().getBaseDir().concat(File.separator).concat("rars").concat(File.separator).concat(pathFile.getName() + ".rar")));
44     }
45 }
46
Popular Tags