1
2
3
4
5
6
7
8 package spellcast.client;
9
10 import java.io.File;
11
12 import org.apache.log4j.Logger;
13 import spellcast.ui.WizardProfiles;
14 import ui.PointUtilities;
15
16 /***
17 * The main class for the Client Spellcast program.
18 *
19 * @author Barrie Treloar
20 */
21 public class Main {
22 Logger logger = Logger.getLogger("client");
23
24 public Main(String[] args) {
25 System.setErr(System.out);
26
27 File spellcastDir = new File(System.getProperty("user.home") + "/.spellcast");
28 logger.debug("Spellcast dir = " + spellcastDir.getAbsolutePath());
29 if (!spellcastDir.exists() && !spellcastDir.mkdir()) {
30 logger.warn(
31 "Unable to create dir: "
32 + spellcastDir.getAbsolutePath()
33 + "\n"
34 + "User preferences will be disabled.");
35 }
36
37 if (!WizardProfiles.profilesFile.exists()) {
38 WizardProfiles wp = new WizardProfiles();
39 wp.setLocation(PointUtilities.centeredOnScreen(wp));
40 wp.setVisible(true);
41 }
42 Client theClient = new Client();
43 theClient.createGUI();
44 theClient.setVisible(true);
45 logger.debug("Spellcast Client started.");
46 }
47
48 public static void main(String[] args) {
49 new Main(args);
50 }
51 }