fixed copyright headers
[svjatoslav_commons.git] / src / main / java / eu / svjatoslav / commons / file / CommonPathResolver.java
1 /*
2  * Svjatoslav Commons - shared library of common functionality.
3  * Copyright ©2012-2013, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of version 2 of the GNU General Public License
7  * as published by the Free Software Foundation.
8  */
9
10 package eu.svjatoslav.commons.file;
11
12 import java.io.File;
13
14 public class CommonPathResolver {
15
16         /**
17          * This method tries to guess user desktop directory. Implementation is
18          * pretty lousy. Need to improve it some day.
19          */
20         public static File getDesktopDirectory() {
21                 String desktopPath = System.getProperty("user.home") + "/Desktop";
22
23                 File desktopFile = new File(desktopPath);
24                 if (desktopFile.exists())
25                         return desktopFile;
26
27                 desktopPath = System.getProperty("user.home") + "/Рабочий стол";
28
29                 desktopFile = new File(desktopPath);
30                 if (desktopFile.exists())
31                         return desktopFile;
32
33                 return null;
34         }
35
36         public static File getHomeDirectory() {
37                 return new File(System.getProperty("user.home"));
38         }
39
40 }