01: /**
02: * $RCSfile: VALinkDebian.java,v $
03: * @creation 28/03/00
04: * @modification $Date: 2005/03/06 23:04:18 $
05: */package com.memoire.vainstall;
06:
07: import java.io.File;
08: import java.io.FileOutputStream;
09: import java.io.IOException;
10: import java.io.PrintWriter;
11:
12: /**
13: * @version $Id: VALinkDebian.java,v 1.3 2005/03/06 23:04:18 deniger Exp $
14: * @author Guillaume Desnoix
15: */
16:
17: public class VALinkDebian {
18: public static boolean create() throws IOException {
19: boolean r = false;
20:
21: // MENU
22:
23: File f = new File(System.getProperty("user.home")
24: + System.getProperty("file.separator") + ".menu");
25:
26: if (f.canWrite()) {
27: String p = "local.vai."
28: + VAGlobals.APP_NAME.toLowerCase()
29: .replace(' ', '_');
30:
31: f = new File(f, p);
32: // System.out.println(""+f);
33: {
34: PrintWriter out = new PrintWriter(new FileOutputStream(
35: f));
36:
37: String s = VAGlobals.LINK_SECTION_NAME;
38: if ("".equals(s))
39: s = "Misc";
40: if ("Applications".equals(s))
41: s = "Misc";
42: if ("Development".equals(s))
43: s = "Programming";
44: if ("Internet".equals(s))
45: s = "Net";
46: if ("Multimedia".equals(s))
47: s = "Sound";
48: if ("Utilities".equals(s))
49: s = "Tools";
50: s = "Apps/" + s;
51:
52: s = "?package(" + p + "):needs=\"X11\" section=\"" + s
53: + "\" title=\"" + VAGlobals.LINK_ENTRY_NAME
54: + "\" command=\""
55: + VAGlobals.APP_NAME.toLowerCase();
56: out.println(s);
57: out.close();
58: }
59:
60: r = true;
61: }
62:
63: return r;
64: }
65:
66: public static boolean delete() throws IOException {
67: boolean r = true;
68:
69: File f = new File(System.getProperty("user.home")
70: + System.getProperty("file.separator") + ".menu");
71:
72: if (f.canWrite()) {
73: String p = "local.vai."
74: + VAGlobals.APP_NAME.toLowerCase()
75: .replace(' ', '_');
76:
77: f = new File(f, p);
78: if (f.exists()) {
79: f.delete();
80: r = true;
81: }
82: }
83:
84: return r;
85: }
86: }
|