1
1
/**
2
2
* Copyright (C) 2000 - 2009 Silverpeas
3
3
*
4
- * This program is free software: you can redistribute it and/or modify
5
- * it under the terms of the GNU Affero General Public License as
6
- * published by the Free Software Foundation, either version 3 of the
7
- * License, or (at your option) any later version.
4
+ * This program is free software: you can redistribute it and/or modify it under the terms of the
5
+ * GNU Affero General Public License as published by the Free Software Foundation, either version 3
6
+ * of the License, or (at your option) any later version.
8
7
*
9
- * As a special exception to the terms and conditions of version 3.0 of
10
- * the GPL, you may redistribute this Program in connection with Free/Libre
11
- * Open Source Software ("FLOSS") applications as described in Silverpeas's
12
- * FLOSS exception. You should have received a copy of the text describing
13
- * the FLOSS exception, and it is also available here:
8
+ * As a special exception to the terms and conditions of version 3.0 of the GPL, you may
9
+ * redistribute this Program in connection with Free/Libre Open Source Software ("FLOSS")
10
+ * applications as described in Silverpeas's FLOSS exception. You should have received a copy of the
11
+ * text describing the FLOSS exception, and it is also available here:
14
12
* "http://repository.silverpeas.com/legal/licensing"
15
13
*
16
- * This program is distributed in the hope that it will be useful,
17
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
- * GNU Affero General Public License for more details.
14
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
15
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ * Affero General Public License for more details.
20
17
*
21
- * You should have received a copy of the GNU Affero General Public License
22
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
- */
24
-
25
- /*
26
- * To change this template, choose Tools | Templates
27
- * and open the template in the editor.
18
+ * You should have received a copy of the GNU Affero General Public License along with this program.
19
+ * If not, see <http://www.gnu.org/licenses/>.
28
20
*/
29
21
package org .silverpeas .openoffice .util ;
30
22
31
- import java .io .File ;
32
-
33
23
/**
34
- * @author Emmanuel Hugonnet
24
+ * Enumeration of supported OS type.
35
25
*/
36
26
public enum OsEnum {
37
27
38
- WINDOWS_XP ("Application Data\\ Mozilla\\ Firefox\\ Profiles" ), WINDOWS_VISTA (
39
- "Appdata\\ Roaming\\ Mozilla\\ Firefox" ), WINDOWS_SEVEN ("Appdata\\ Roaming\\ Mozilla\\ Firefox" ), LINUX (
40
- ".mozilla/firefox" ), MAC_OSX (".mozilla/firefox" );
41
- protected String profilesDir ;
28
+ WINDOWS_XP , WINDOWS_VISTA , WINDOWS_SEVEN , WINDOWS_8 , LINUX , MAC_OSX ;
42
29
43
- OsEnum (String profilesDir ) {
44
- this .profilesDir = profilesDir ;
30
+ OsEnum () {
45
31
}
46
32
47
33
public static OsEnum getOS (String value ) {
@@ -51,6 +37,9 @@ public static OsEnum getOS(String value) {
51
37
if ("Windows 7" .equalsIgnoreCase (value )) {
52
38
return WINDOWS_SEVEN ;
53
39
}
40
+ if ("Windows 8" .equalsIgnoreCase (value )) {
41
+ return WINDOWS_8 ;
42
+ }
54
43
if ("Windows XP" .equalsIgnoreCase (value ) || value .startsWith ("Windows " )) {
55
44
return WINDOWS_XP ;
56
45
}
@@ -60,20 +49,20 @@ public static OsEnum getOS(String value) {
60
49
return MAC_OSX ;
61
50
}
62
51
52
+ /**
53
+ * Detect the local OS.
54
+ *
55
+ * @return the OS on which the code is running.
56
+ */
63
57
public static OsEnum getOS () {
64
58
return getOS (System .getProperty ("os.name" ));
65
59
}
66
60
67
- public String getProfilesDirectory () {
68
- return System .getProperty ("user.home" ) + File .separator + profilesDir ;
69
- }
70
-
71
-
72
61
public static boolean isWindows () {
73
62
OsEnum currentOS = getOS ();
74
63
return currentOS == WINDOWS_SEVEN || currentOS == WINDOWS_XP || currentOS == WINDOWS_VISTA ;
75
64
}
76
-
65
+
77
66
public static boolean isLinux () {
78
67
return getOS () == LINUX ;
79
68
}
0 commit comments