1 package cx.fbn.nevernote.config;
8 * Things that can only be changed at startup
12 public class StartupConfig {
14 // Init to default values
15 private String name = "NeverNote";
16 private String homeDirPath;
17 private String programDirPath;
18 private boolean disableViewing = false;
19 private boolean syncOnly = false;
22 public String getName() {
26 public void setName(String n) {
28 name = "NeverNote-" + n;
32 public String getProgramDirPath() {
33 if (programDirPath == null) {
34 programDirPath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath();
35 if (programDirPath.endsWith(".jar")) {
36 programDirPath = programDirPath.substring(0,programDirPath.lastIndexOf("/"));
38 if (programDirPath.endsWith("/")) {
39 programDirPath = programDirPath.substring(0,programDirPath.length()-1);
41 programDirPath = programDirPath.substring(0,programDirPath.lastIndexOf("/"));
44 return programDirPath;
47 public String getHomeDirPath() {
48 if (homeDirPath == null) {
49 homeDirPath = System.getProperty("user.home") + File.separator
50 + "." +name.toLowerCase() + File.separator;
55 public void setHomeDirPath(String path) {
56 if (isNonEmpty(path)) {
61 public void setProgramDirPath(String path) {
62 if (isNonEmpty(path)) {
63 programDirPath = path;
68 public boolean getDisableViewing() {
69 return disableViewing;
72 public void setDisableViewing(boolean disableViewing) {
73 this.disableViewing = disableViewing;
76 private static boolean isNonEmpty(String n) {
77 return n != null && !n.trim().equals("");
80 public boolean isSyncOnly() {
84 public void setSyncOnly(boolean val) {