Last change
on this file since 14253 was 14138, checked in by Don-vip, 6 years ago |
see #15229 - deprecate Main.platform and related methods - new class PlatformManager
|
-
Property svn:eol-style
set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | /**
|
---|
5 | * Holder for current platform hook.
|
---|
6 | * @since 14138
|
---|
7 | */
|
---|
8 | public final class PlatformManager {
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Platform specific code goes in here.
|
---|
12 | */
|
---|
13 | private static final PlatformHook PLATFORM = Platform.determinePlatform().accept(PlatformHook.CONSTRUCT_FROM_PLATFORM);
|
---|
14 |
|
---|
15 | private PlatformManager() {
|
---|
16 | // Hide constructor
|
---|
17 | }
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Returns the current platform hook.
|
---|
21 | * @return the current platform hook
|
---|
22 | */
|
---|
23 | public static PlatformHook getPlatform() {
|
---|
24 | return PLATFORM;
|
---|
25 | }
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * Determines if we are currently running on macOS.
|
---|
29 | * @return {@code true} if we are currently running on macOS
|
---|
30 | */
|
---|
31 | public static boolean isPlatformOsx() {
|
---|
32 | return PLATFORM instanceof PlatformHookOsx;
|
---|
33 | }
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Determines if we are currently running on an Unix system.
|
---|
37 | * @return {@code true} if we are currently running on an Unix system
|
---|
38 | */
|
---|
39 | public static boolean isPlatformUnixoid() {
|
---|
40 | return PLATFORM instanceof PlatformHookUnixoid;
|
---|
41 | }
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * Determines if we are currently running on Windows.
|
---|
45 | * @return {@code true} if we are currently running on Windows
|
---|
46 | */
|
---|
47 | public static boolean isPlatformWindows() {
|
---|
48 | return PLATFORM instanceof PlatformHookWindows;
|
---|
49 | }
|
---|
50 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.