1 | package org.expeditee.settings;
|
---|
2 |
|
---|
3 | import java.awt.Color;
|
---|
4 | import java.awt.Font;
|
---|
5 | import java.awt.GraphicsEnvironment;
|
---|
6 | import java.io.File;
|
---|
7 | import java.io.FileNotFoundException;
|
---|
8 | import java.io.IOException;
|
---|
9 | import java.util.ArrayList;
|
---|
10 | import java.util.Arrays;
|
---|
11 | import java.util.LinkedList;
|
---|
12 | import java.util.List;
|
---|
13 |
|
---|
14 | import org.expeditee.agents.SearchGreenstone;
|
---|
15 | import org.expeditee.agents.mail.MailSession;
|
---|
16 | import org.expeditee.agents.wordprocessing.JSpellChecker;
|
---|
17 | import org.expeditee.gui.AttributeValuePair;
|
---|
18 | import org.expeditee.gui.DisplayIO;
|
---|
19 | import org.expeditee.gui.Frame;
|
---|
20 | import org.expeditee.gui.FrameIO;
|
---|
21 | import org.expeditee.gui.FrameUtils;
|
---|
22 | import org.expeditee.gui.FreeItems;
|
---|
23 | import org.expeditee.gui.MessageBay;
|
---|
24 | import org.expeditee.items.Item;
|
---|
25 | import org.expeditee.items.ItemUtils;
|
---|
26 | import org.expeditee.items.Text;
|
---|
27 | import org.expeditee.setting.ArraySetting;
|
---|
28 | import org.expeditee.setting.BooleanSetting;
|
---|
29 | import org.expeditee.setting.FloatSetting;
|
---|
30 | import org.expeditee.setting.FrameSetting;
|
---|
31 | import org.expeditee.setting.FunctionSetting;
|
---|
32 | import org.expeditee.setting.IntegerSetting;
|
---|
33 | import org.expeditee.setting.ListSetting;
|
---|
34 | import org.expeditee.setting.Setting;
|
---|
35 | import org.expeditee.setting.StringSetting;
|
---|
36 | import org.expeditee.setting.TextSetting;
|
---|
37 |
|
---|
38 | /**
|
---|
39 | * Central class to contain all values that can be set by the user on their
|
---|
40 | * profile frame. These values should be updated only by
|
---|
41 | * FrameUtils.ParseProfile.
|
---|
42 | */
|
---|
43 | public abstract class UserSettings {
|
---|
44 |
|
---|
45 | public final static String DEFAULT_PROFILE_NAME = "default";
|
---|
46 |
|
---|
47 | public static final IntegerSetting Gravity = new IntegerSetting("Distance the cursor has to be from a text item to select the text item", 3);
|
---|
48 |
|
---|
49 | public static final StringSetting StartFrame = new StringSetting("The frame to go to when Expeditee is started (defaults to the profile frame)", null);
|
---|
50 |
|
---|
51 | /*
|
---|
52 | * Stuff that goes first
|
---|
53 | */
|
---|
54 | public static final StringSetting HomeFrame = new StringSetting("The home frame", null) {
|
---|
55 | @Override
|
---|
56 | public boolean setSetting(Text text) {
|
---|
57 | if(text.getText().indexOf(':') == -1 || !text.hasLink()) {
|
---|
58 | text.setLink(FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName());
|
---|
59 | }
|
---|
60 | String first = FrameUtils.getLink(text, UserSettings.HomeFrame.get());
|
---|
61 | // do not use non-existant frames as the first frame
|
---|
62 | if (FrameIO.isValidFrameName(first)) {
|
---|
63 | _value = first;
|
---|
64 | }
|
---|
65 | // warn the user
|
---|
66 | else {
|
---|
67 | // MessageBay.warningMessage("Home frame: " + first
|
---|
68 | // + " is not a valid frame.");
|
---|
69 | _value = FrameIO.LoadProfile(UserSettings.ProfileName.get()).getName();
|
---|
70 | }
|
---|
71 | return true;
|
---|
72 | }
|
---|
73 | };
|
---|
74 | public static final StringSetting DefaultFrame = new StringSetting("The default frame", null) {
|
---|
75 | @Override
|
---|
76 | public boolean setSetting(Text text) {
|
---|
77 | _value = FrameUtils.getLink(text, _value);
|
---|
78 | return true;
|
---|
79 | }
|
---|
80 | };
|
---|
81 | public static final IntegerSetting InitialWidth = new IntegerSetting("Initial width of Expeditee window", 1024);
|
---|
82 |
|
---|
83 | public static final IntegerSetting InitialHeight = new IntegerSetting("Initial height of Expeditee window", 768);
|
---|
84 |
|
---|
85 | public static final TextSetting ItemTemplate = new TextSetting("Template for normal text items") {
|
---|
86 | @Override
|
---|
87 | public Text generateText() {
|
---|
88 | return new Text("ItemTemplate");
|
---|
89 | }
|
---|
90 | };
|
---|
91 | public static final TextSetting AnnotationTemplate = new TextSetting("Template for annotation text items") {
|
---|
92 | @Override
|
---|
93 | public Text generateText() {
|
---|
94 | Text t = new Text("AnnotationTemplate");
|
---|
95 | t.setColor(Color.gray);
|
---|
96 | return t;
|
---|
97 | }
|
---|
98 | };
|
---|
99 |
|
---|
100 | public static final TextSetting CommentTemplate = new TextSetting("Template for code comment text items") {
|
---|
101 | @Override
|
---|
102 | public Text generateText() {
|
---|
103 | Text t = new Text("CommentTemplate");
|
---|
104 | t.setColor(Color.green.darker());
|
---|
105 | return t;
|
---|
106 | }
|
---|
107 | };
|
---|
108 |
|
---|
109 | public static final TextSetting StatTemplate = new TextSetting("Template for statistics (e.g. extracted attributes) text items") {
|
---|
110 | @Override
|
---|
111 | public Text generateText() {
|
---|
112 | Text t = new Text("StatsTemplate");
|
---|
113 | t.setColor(Color.BLACK);
|
---|
114 | t.setBackgroundColor(new Color(0.9F, 0.9F, 0.9F));
|
---|
115 | t.setFamily(Text.MONOSPACED_FONT);
|
---|
116 | t.setSize(14);
|
---|
117 | return t;
|
---|
118 | }
|
---|
119 | };
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * General settings (no setter functions)
|
---|
123 | */
|
---|
124 |
|
---|
125 | public static final FloatSetting ScaleFactor = new FloatSetting("Scale Factor for drawing (TODO: does this even do anything?)", 1F);
|
---|
126 |
|
---|
127 | public static final FloatSetting FormatSpacingMin = new FloatSetting("Minimum spacing ratio", null);
|
---|
128 |
|
---|
129 | public static final FloatSetting FormatSpacingMax = new FloatSetting("Maximum spacing ratio", null);
|
---|
130 |
|
---|
131 | public static final IntegerSetting LineStraightenThreshold = new IntegerSetting("Threshold for straightening a line (TODO: does this even do anything?)", 15);
|
---|
132 |
|
---|
133 | public static final IntegerSetting NoOpThreshold = new IntegerSetting("Distance the cursor may be dragged while clicking before the operation is cancelled", 60);
|
---|
134 |
|
---|
135 | public static final IntegerSetting TitlePosition = new IntegerSetting("Position of title item in frame (TODO: find whether this is x-offset or y-offset)", 150);
|
---|
136 |
|
---|
137 | public static final StringSetting ProfileName = new StringSetting("Profile name", FrameIO.ConvertToValidFramesetName(System.getProperty("user.name")));
|
---|
138 |
|
---|
139 | public static final StringSetting UserName = new StringSetting("User name", ProfileName.get());
|
---|
140 |
|
---|
141 | public static final BooleanSetting AntiAlias = new BooleanSetting("Whether anti-aliasing should be enabled", false);
|
---|
142 |
|
---|
143 | public static final BooleanSetting LineHighlight = new BooleanSetting("Whether lines should be highlighted", false);
|
---|
144 |
|
---|
145 | public static final BooleanSetting Logging = new BooleanSetting("Whether logging should be enabled", false);
|
---|
146 |
|
---|
147 | public static final BooleanSetting LogStats = new BooleanSetting("Whether stats should be logged", true);
|
---|
148 |
|
---|
149 | public static final BooleanSetting Threading = new BooleanSetting("Whether threading should be enabled", true);
|
---|
150 |
|
---|
151 |
|
---|
152 | /*
|
---|
153 | * Frames
|
---|
154 | */
|
---|
155 |
|
---|
156 | public static final StringSetting StatisticsFrameset = new StringSetting("The statistics frameset", null);
|
---|
157 |
|
---|
158 | public static final StringSetting MenuFrame = new StringSetting("The menu frame", null);
|
---|
159 |
|
---|
160 | /*
|
---|
161 | * Directories
|
---|
162 | */
|
---|
163 | public static final ListSetting<String> FrameDirs = new ListSetting<String>("Directories to look in for frames") {
|
---|
164 | @Override
|
---|
165 | public boolean setSetting(Text text) {
|
---|
166 | _value.addAll(FrameUtils.getDirs(text));
|
---|
167 | return true;
|
---|
168 | }
|
---|
169 | };
|
---|
170 | public static final Setting FramesetDir = new Setting("Adds a directory to look in for frames") {
|
---|
171 | @Override
|
---|
172 | public boolean setSetting(Text text) {
|
---|
173 | if(text.getText().indexOf(':') == -1) {
|
---|
174 | return false;
|
---|
175 | }
|
---|
176 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
177 | if(avp.getValue().trim().length() != 0) {
|
---|
178 | String dir = FrameUtils.getDir(avp.getValue());
|
---|
179 | if (dir != null) {
|
---|
180 | UserSettings.FrameDirs.get().add(dir);
|
---|
181 | return true;
|
---|
182 | }
|
---|
183 | }
|
---|
184 | return false;
|
---|
185 | }
|
---|
186 | };
|
---|
187 |
|
---|
188 | public static ListSetting<String> ImageDirs = new ListSetting<String>("Directories to look in for images") {
|
---|
189 | @Override
|
---|
190 | public boolean setSetting(Text text) {
|
---|
191 | _value.addAll(FrameUtils.getDirs(text));
|
---|
192 | return true;
|
---|
193 | }
|
---|
194 | };
|
---|
195 | public static final Setting ImageDir = new Setting("Adds a directory to look in for images") {
|
---|
196 | @Override
|
---|
197 | public boolean setSetting(Text text) {
|
---|
198 | if(text.getText().indexOf(':') == -1) {
|
---|
199 | return false;
|
---|
200 | }
|
---|
201 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
202 | if(avp.getValue().trim().length() != 0) {
|
---|
203 | String dir = FrameUtils.getDir(avp.getValue());
|
---|
204 | if(dir != null) {
|
---|
205 | UserSettings.ImageDirs.get().add(0, dir);
|
---|
206 | return true;
|
---|
207 | }
|
---|
208 | }
|
---|
209 | return false;
|
---|
210 | }
|
---|
211 | };
|
---|
212 |
|
---|
213 | public static final Setting LogDir = new Setting("Set the directory to save logs") {
|
---|
214 | @Override
|
---|
215 | public boolean setSetting(Text text) {
|
---|
216 | if(text.getText().indexOf(':') == -1) {
|
---|
217 | return false;
|
---|
218 | }
|
---|
219 | AttributeValuePair avp = new AttributeValuePair(text.getText());
|
---|
220 | if(avp.getValue().trim().length() != 0) {
|
---|
221 | FrameIO.LOGS_DIR = FrameUtils.getDir(avp.getValue());
|
---|
222 | }
|
---|
223 | return true;
|
---|
224 | }
|
---|
225 | };
|
---|
226 |
|
---|
227 | /*
|
---|
228 | * Templates
|
---|
229 | */
|
---|
230 | public static final TextSetting TitleTemplate = new TextSetting("Template for Title text item") {
|
---|
231 | @Override
|
---|
232 | public Text generateText() {
|
---|
233 | Text t = new Text("TitleTemplate");
|
---|
234 | t.setSize(30);
|
---|
235 | t.setFontStyle("Bold");
|
---|
236 | t.setFamily("SansSerif");
|
---|
237 | t.setColor(Color.BLUE);
|
---|
238 | t.setPosition(25, 50);
|
---|
239 | return t;
|
---|
240 | }
|
---|
241 | };
|
---|
242 |
|
---|
243 | public static final TextSetting DotTemplate = new TextSetting("Template for dot items") {
|
---|
244 | @Override
|
---|
245 | public Text generateText() {
|
---|
246 | return new Text("DotTemplate");
|
---|
247 | }
|
---|
248 | };
|
---|
249 |
|
---|
250 | public static final TextSetting TooltipTemplate = new TextSetting("Template for tooltips") {
|
---|
251 | @Override
|
---|
252 | public Text generateText() {
|
---|
253 | Text t = new Text("TooltipTemplate");
|
---|
254 | t.setColor(Color.BLACK);
|
---|
255 | t.setBackgroundColor(new Color(0.7F, 0.7F, 0.9F));
|
---|
256 | // t.setFamily(Text.MONOSPACED_FONT);
|
---|
257 | t.setSize(14);
|
---|
258 | return t;
|
---|
259 | }
|
---|
260 | };
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * Colorwheels
|
---|
264 | */
|
---|
265 | public static final ArraySetting<Color> ColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
266 | new Color[] { Color.BLACK, Color.RED, Color.BLUE, Item.GREEN, Color.MAGENTA, Color.YELLOW.darker(), Color.WHITE }) {
|
---|
267 | @Override
|
---|
268 | public boolean setSetting(Text text) {
|
---|
269 | Frame child = text.getChild();
|
---|
270 | if (child == null) {
|
---|
271 | return false;
|
---|
272 | }
|
---|
273 | _value = FrameUtils.getColorWheel(child);
|
---|
274 | return true;
|
---|
275 | }
|
---|
276 | };
|
---|
277 |
|
---|
278 | public static final ArraySetting<Color> FillColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
279 | new Color[] { new Color(255, 150, 150), new Color(150, 150, 255), new Color(150, 255, 150),
|
---|
280 | new Color(255, 150, 255), new Color(255, 255, 100), Color.WHITE, Color.BLACK }) {
|
---|
281 | @Override
|
---|
282 | public boolean setSetting(Text text) {
|
---|
283 | Frame child = text.getChild();
|
---|
284 | if (child == null) {
|
---|
285 | return false;
|
---|
286 | }
|
---|
287 | _value = FrameUtils.getColorWheel(child);
|
---|
288 | return true;
|
---|
289 | }
|
---|
290 | };
|
---|
291 |
|
---|
292 | public static final ArraySetting<Color> BackgroundColorWheel = new ArraySetting<Color>("The colours of items in the child frame are used to populate the colour wheel",
|
---|
293 | new Color[] { new Color(235, 235, 235), new Color(225, 225, 255), new Color(195, 255, 255),
|
---|
294 | new Color(225, 255, 225), new Color(255, 255, 195), new Color(255, 225, 225),
|
---|
295 | new Color(255, 195, 255), Color.WHITE, Color.GRAY, Color.DARK_GRAY, Color.BLACK, null }) {
|
---|
296 | @Override
|
---|
297 | public boolean setSetting(Text text) {
|
---|
298 | Frame child = text.getChild();
|
---|
299 | if (child == null) {
|
---|
300 | return false;
|
---|
301 | }
|
---|
302 | _value = FrameUtils.getColorWheel(child);
|
---|
303 | return true;
|
---|
304 | }
|
---|
305 | };
|
---|
306 |
|
---|
307 | /*
|
---|
308 | * Other
|
---|
309 | */
|
---|
310 | public static final ListSetting<Text> Style = new ListSetting<Text>("Set the style (TODO: what does this do?)") {
|
---|
311 | @Override
|
---|
312 | public boolean setSetting(Text text) {
|
---|
313 | Frame child = text.getChild();
|
---|
314 | if (child == null) {
|
---|
315 | _value = new LinkedList<Text>();
|
---|
316 | return true;
|
---|
317 | }
|
---|
318 |
|
---|
319 |
|
---|
320 | List<Text> style = new ArrayList<Text>(8);
|
---|
321 | for (int i = 0; i < 10; i++) {
|
---|
322 | style.add(null);
|
---|
323 | }
|
---|
324 |
|
---|
325 | for (Text t : child.getBodyTextItems(false)) {
|
---|
326 | String type = t.getText();
|
---|
327 | char lastChar = type.charAt(type.length() - 1);
|
---|
328 | if (Character.isDigit(lastChar)) {
|
---|
329 | style.set(lastChar - '0', t);
|
---|
330 | } else {
|
---|
331 | style.set(0, t);
|
---|
332 | }
|
---|
333 | }
|
---|
334 | _value = style;
|
---|
335 | return true;
|
---|
336 | }
|
---|
337 | };
|
---|
338 |
|
---|
339 | public static final FunctionSetting SpellChecker = new FunctionSetting("Enables the dictionary with the default dictionary") {
|
---|
340 | @Override
|
---|
341 | public void run() {
|
---|
342 | try {
|
---|
343 | JSpellChecker.create();
|
---|
344 | } catch (FileNotFoundException e) {
|
---|
345 | MessageBay.errorMessage("Could not find dictionary: " + e.getMessage());
|
---|
346 | } catch (IOException e) {
|
---|
347 | e.printStackTrace();
|
---|
348 | }
|
---|
349 | }
|
---|
350 | };
|
---|
351 | public static final FrameSetting Spelling = new FrameSetting("Enables the dictionary and adds the items in the child frame to the dictionary") {
|
---|
352 | @Override
|
---|
353 | public void run(Frame frame) {
|
---|
354 | try {
|
---|
355 | JSpellChecker.create(frame);
|
---|
356 | } catch (Exception e) {
|
---|
357 | e.printStackTrace();
|
---|
358 | }
|
---|
359 | }
|
---|
360 | };
|
---|
361 |
|
---|
362 | public static final FrameSetting GreenstoneSettings = new FrameSetting("Greenstone settings (TODO: What are these for?)") {
|
---|
363 | @Override
|
---|
364 | public void run(Frame frame) {
|
---|
365 | SearchGreenstone.init(frame);
|
---|
366 | }
|
---|
367 | };
|
---|
368 |
|
---|
369 | public static final FrameSetting Reminders = new FrameSetting("Reminders (TODO: What are these for?)") {
|
---|
370 | @Override
|
---|
371 | public void run(Frame frame) {
|
---|
372 | org.expeditee.gui.Reminders.init(frame);
|
---|
373 | }
|
---|
374 | };
|
---|
375 |
|
---|
376 | public static final FrameSetting MailSettings = new FrameSetting("Mail Settings (TODO: How does this work?)") {
|
---|
377 | @Override
|
---|
378 | public void run(Frame frame) {
|
---|
379 | MailSession.init(frame);
|
---|
380 | }
|
---|
381 | };
|
---|
382 |
|
---|
383 | public static final FrameSetting CursorFrame = new FrameSetting("Items on this frame will be used as the cursor (clearing the frame or removing the link will default back to a normal cursor)") {
|
---|
384 | @Override
|
---|
385 | public void run(Frame frame) {
|
---|
386 | FreeItems.getCursor().addAll(ItemUtils.CopyItems(frame.getAllItems()));
|
---|
387 | for (Item i : FreeItems.getCursor()) {
|
---|
388 | i.setParent(null);
|
---|
389 | }
|
---|
390 | DisplayIO.setCursor(Item.HIDDEN_CURSOR);
|
---|
391 | DisplayIO.setCursor(Item.DEFAULT_CURSOR);
|
---|
392 | }
|
---|
393 | };
|
---|
394 |
|
---|
395 |
|
---|
396 | protected static final String filenameExtension(String fileName) {
|
---|
397 | // Code excerpt from:
|
---|
398 | // http://stackoverflow.com/questions/3571223/how-do-i-get-the-file-extension-of-a-file-in-java
|
---|
399 | // packed up here as a method
|
---|
400 |
|
---|
401 | String extension = "";
|
---|
402 |
|
---|
403 | int i = fileName.lastIndexOf('.');
|
---|
404 | int p = Math.max(fileName.lastIndexOf('/'), fileName.lastIndexOf('\\'));
|
---|
405 |
|
---|
406 | if (i > p) {
|
---|
407 | extension = fileName.substring(i+1);
|
---|
408 | }
|
---|
409 |
|
---|
410 | return extension;
|
---|
411 | }
|
---|
412 |
|
---|
413 | // add default values
|
---|
414 | static {
|
---|
415 | String expeditee_home = System.getProperty("expeditee.home");
|
---|
416 | if (expeditee_home != null) {
|
---|
417 | FrameIO.changeParentFolder(expeditee_home + File.separator);
|
---|
418 | } else {
|
---|
419 | FrameIO.changeParentFolder(getSaveLocation());
|
---|
420 | }
|
---|
421 |
|
---|
422 | UserSettings.FrameDirs.get().add(FrameIO.FRAME_PATH);
|
---|
423 | UserSettings.FrameDirs.get().add(FrameIO.PUBLIC_PATH);
|
---|
424 | UserSettings.FrameDirs.get().add(FrameIO.PROFILE_PATH);
|
---|
425 | UserSettings.FrameDirs.get().add(FrameIO.HELP_PATH);
|
---|
426 | UserSettings.FrameDirs.get().add(FrameIO.MESSAGES_PATH);
|
---|
427 | UserSettings.FrameDirs.setDefault(UserSettings.FrameDirs.get());
|
---|
428 | UserSettings.ImageDirs.get().add(FrameIO.IMAGES_PATH);
|
---|
429 | UserSettings.ImageDirs.setDefault(UserSettings.ImageDirs.get());
|
---|
430 |
|
---|
431 |
|
---|
432 |
|
---|
433 | try {
|
---|
434 | GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
---|
435 |
|
---|
436 | if (ge != null) {
|
---|
437 |
|
---|
438 |
|
---|
439 | File fontDirectory = new File(FrameIO.FONT_PATH);
|
---|
440 | if (fontDirectory != null) {
|
---|
441 | File[] fontFiles = fontDirectory.listFiles();
|
---|
442 | if (fontFiles != null) {
|
---|
443 |
|
---|
444 | if (fontFiles.length>0) {
|
---|
445 | System.out.println("Loading custom fonts:");
|
---|
446 | }
|
---|
447 |
|
---|
448 | boolean first_item = true;
|
---|
449 | for (File fontFile : fontFiles) {
|
---|
450 |
|
---|
451 | String ext = filenameExtension(fontFile.getName().toLowerCase());
|
---|
452 |
|
---|
453 | if (ext.equals("ttf")) {
|
---|
454 | if (first_item) {
|
---|
455 | System.out.print(" " + fontFile.getName());
|
---|
456 | }
|
---|
457 | else {
|
---|
458 | System.out.print(", " + fontFile.getName());
|
---|
459 | }
|
---|
460 | System.out.flush();
|
---|
461 |
|
---|
462 | Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile);
|
---|
463 |
|
---|
464 | ge.registerFont(font);
|
---|
465 | first_item = false;
|
---|
466 | }
|
---|
467 | }
|
---|
468 | System.out.println();
|
---|
469 |
|
---|
470 | }
|
---|
471 | }
|
---|
472 | }
|
---|
473 | else {
|
---|
474 | System.err.println("No graphics environment detected. Skipping the loading of the custom font Metamorphous");
|
---|
475 | }
|
---|
476 | }
|
---|
477 | catch (Exception e) {
|
---|
478 | System.err.println("Failed to load custom font Metamorphous");
|
---|
479 | e.printStackTrace();
|
---|
480 | }
|
---|
481 |
|
---|
482 |
|
---|
483 |
|
---|
484 | }
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * Find the appropriate directory to store application settings in for
|
---|
488 | * the current OS.
|
---|
489 | * This has only been tested on Linux so far, so if it doesn't work it
|
---|
490 | * may need to be modified or reverted. Should return:
|
---|
491 | * Linux: ~/.expeditee
|
---|
492 | * Windows: %appdata%\.expeditee
|
---|
493 | * Mac: ~/Library/Application\ Support/.expeditee
|
---|
494 | * @return the path to store expeditee's settings
|
---|
495 | */
|
---|
496 | public static String getSaveLocation() {
|
---|
497 | String OS=System.getProperty("os.name").toLowerCase();
|
---|
498 | if(OS.indexOf("win")>0) { //windoze
|
---|
499 | return System.getenv("APPDATA")+File.separator+".expeditee"+File.separator;
|
---|
500 | } else if(OS.indexOf("mac")>0) { //mac
|
---|
501 | return System.getProperty("user.home")+File.separator+"Library"+File.separator+"Application Support"+File.separator+".expeditee"+File.separator;
|
---|
502 | } else { //linux or other
|
---|
503 | return System.getProperty("user.home")+File.separator+".expeditee"+File.separator;
|
---|
504 | }
|
---|
505 | }
|
---|
506 | }
|
---|