Skip to content

Commit f63bc53

Browse files
committed
Provide OSHelper
1 parent 612a708 commit f63bc53

File tree

2 files changed

+44
-23
lines changed

2 files changed

+44
-23
lines changed
Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2013-2016 Angelo ZERR.
2+
* Copyright (c) 2015-2017 Angelo ZERR.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License v1.0
55
* which accompanies this distribution, and is available at
@@ -10,44 +10,27 @@
1010
*/
1111
package ts.eclipse.ide.core.nodejs;
1212

13-
import org.eclipse.core.runtime.Platform;
14-
15-
import ts.OS;
13+
import ts.eclipse.ide.core.utils.OSHelper;
1614
import ts.nodejs.NodejsProcessHelper;
1715

1816
/**
1917
* IDE node.js process helper.
2018
*/
2119
public class IDENodejsProcessHelper {
2220

23-
private static final OS os;
24-
25-
static {
26-
if (Platform.getOS().startsWith("win")) {
27-
os = OS.Windows;
28-
} else if (Platform.getOS().equals(Platform.OS_MACOSX)) {
29-
os = OS.MacOS;
30-
} else {
31-
os = OS.Linux;
32-
}
33-
}
34-
3521
private IDENodejsProcessHelper() {
3622
}
3723

3824
public static String getNodejsPath() {
39-
return NodejsProcessHelper.getNodejsPath(os);
25+
return NodejsProcessHelper.getNodejsPath(OSHelper.getOs());
4026
}
4127

4228
public static String[] getDefaultNodejsPaths() {
43-
return NodejsProcessHelper.getDefaultNodejsPaths(os);
29+
return NodejsProcessHelper.getDefaultNodejsPaths(OSHelper.getOs());
4430
}
45-
31+
4632
public static String[] getAvailableNodejsPaths() {
47-
return NodejsProcessHelper.getNodejsPaths(os);
33+
return NodejsProcessHelper.getNodejsPaths(OSHelper.getOs());
4834
}
4935

50-
public static OS getOs() {
51-
return os;
52-
}
5336
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (c) 2015-2017 Angelo ZERR.
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* which accompanies this distribution, and is available at
6+
* http://www.eclipse.org/legal/epl-v10.html
7+
*
8+
* Contributors:
9+
* Angelo Zerr <[email protected]> - initial API and implementation
10+
*/
11+
package ts.eclipse.ide.core.utils;
12+
13+
import org.eclipse.core.runtime.Platform;
14+
15+
import ts.OS;
16+
17+
/**
18+
* OS Helper.
19+
*
20+
*/
21+
public class OSHelper {
22+
23+
private static final OS os;
24+
25+
static {
26+
if (Platform.getOS().startsWith("win")) {
27+
os = OS.Windows;
28+
} else if (Platform.getOS().equals(Platform.OS_MACOSX)) {
29+
os = OS.MacOS;
30+
} else {
31+
os = OS.Linux;
32+
}
33+
}
34+
35+
public static OS getOs() {
36+
return os;
37+
}
38+
}

0 commit comments

Comments
 (0)