@@ -29,7 +29,6 @@ public class Common {
29
29
30
30
public final static String sloeberHome = getSloeberHome ();
31
31
public final static IPath sloeberHomePath = new Path (sloeberHome );
32
- public final static String sloeberHomePathToOSString = sloeberHomePath .toOSString ();
33
32
public final static String sloeberHomePathToString = sloeberHomePath .toString ();
34
33
35
34
private static String getSloeberHome () {
@@ -54,68 +53,66 @@ private static String getSloeberHome() {
54
53
e ));
55
54
}
56
55
return null ;
57
- }
58
-
59
-
56
+ }
60
57
61
58
public static final boolean isWindows = Platform .getOS ().equals (Platform .OS_WIN32 );
62
59
public static final boolean isLinux = Platform .getOS ().equals (Platform .OS_LINUX );
63
60
public static final boolean isMac = Platform .getOS ().equals (Platform .OS_MACOSX );
64
61
65
-
66
62
/**
67
63
* This method makes sure that a string can be used as a file or folder name
68
64
* <br/>
69
65
* To do this it replaces all unacceptable characters with underscores.<br/>
70
66
* Currently it replaces (based on http://en.wikipedia.org/wiki/Filename ) /
71
67
* slash used as a path name component separator in Unix-like, Windows, and
72
68
* Amiga systems. (The MS-DOS command.com shell would consume it as a switch
73
- * character, but Windows itself always accepts it as a
69
+ * character, but Windows itself always accepts it as a
74
70
* separator.[6][vague]) \ backslash Also used as a path name component
75
71
* separator in MS-DOS, OS/2 and Windows (where there are few differences
76
72
* between slash and backslash); allowed in Unix filenames, see Note 1 ?
77
- * question mark used as a wildcard in Unix, Windows and AmigaOS; marks a
78
- * single character. Allowed in Unix filenames, see Note 1 % percent used as
79
- * a wildcard in RT-11; marks a single character. asterisk or star used as a
80
- * wildcard in Unix, MS-DOS, RT-11, VMS and Windows. Marks any sequence of
81
- * characters (Unix, Windows, later versions of MS-DOS) or any sequence of
82
- * characters in either the basename or extension (thus "*.*" in early
83
- * versions of MS-DOS means "all files". Allowed in Unix filenames, see note
84
- * 1 : colon used to determine the mount point / drive on Windows; used to
85
- * determine the virtual device or physical device such as a drive on
86
- * AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac OS.
87
- * Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
88
- * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar
89
- * or pipe designates software pipelining in Unix and Windows; allowed in
90
- * Unix filenames, see Note 1 " quote used to mark beginning and end of
91
- * filenames containing spaces in Windows, see Note 1 < less than used to
92
- * redirect input, allowed in Unix filenames, see Note 1 > greater than used
93
- * to redirect output, allowed in Unix filenames, see Note 1 . period or dot
73
+ * question mark used as a wildcard in Unix, Windows and AmigaOS; marks a
74
+ * single character. Allowed in Unix filenames, see Note 1 % percent used as
75
+ * a wildcard in RT-11; marks a single character. asterisk or star used as a
76
+ * wildcard in Unix, MS-DOS, RT-11, VMS and Windows. Marks any sequence of
77
+ * characters (Unix, Windows, later versions of MS-DOS) or any sequence of
78
+ * characters in either the basename or extension (thus "*.*" in early
79
+ * versions of MS-DOS means "all files". Allowed in Unix filenames, see note
80
+ * 1 : colon used to determine the mount point / drive on Windows; used to
81
+ * determine the virtual device or physical device such as a drive on
82
+ * AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac OS.
83
+ * Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
84
+ * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar
85
+ * or pipe designates software pipelining in Unix and Windows; allowed in
86
+ * Unix filenames, see Note 1 " quote used to mark beginning and end of
87
+ * filenames containing spaces in Windows, see Note 1 < less than used to
88
+ * redirect input, allowed in Unix filenames, see Note 1 > greater than used
89
+ * to redirect output, allowed in Unix filenames, see Note 1 . period or dot
94
90
*
95
- * # is excluded as it is seen as a special character by make
96
- =======
97
- * character, but Windows itself always accepts it as a separator.[6][vague]) \
98
- * backslash Also used as a path name component separator in MS-DOS, OS/2 and
99
- * Windows (where there are few differences between slash and backslash);
100
- * allowed in Unix filenames, see Note 1 ? question mark used as a wildcard in
101
- * Unix, Windows and AmigaOS; marks a single character. Allowed in Unix
102
- * filenames, see Note 1 % percent used as a wildcard in RT-11; marks a single
103
- * character. asterisk or star used as a wildcard in Unix, MS-DOS, RT-11, VMS
104
- * and Windows. Marks any sequence of characters (Unix, Windows, later versions
105
- * of MS-DOS) or any sequence of characters in either the basename or extension
106
- * (thus "*.*" in early versions of MS-DOS means "all files". Allowed in Unix
107
- * filenames, see note 1 : colon used to determine the mount point / drive on
108
- * Windows; used to determine the virtual device or physical device such as a
109
- * drive on AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac
110
- * OS. Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
111
- * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar or
112
- * pipe designates software pipelining in Unix and Windows; allowed in Unix
91
+ * # is excluded as it is seen as a special character by make
92
+ * =======
93
+ * character, but Windows itself always accepts it as a separator.[6][vague]) \
94
+ * backslash Also used as a path name component separator in MS-DOS, OS/2 and
95
+ * Windows (where there are few differences between slash and backslash);
96
+ * allowed in Unix filenames, see Note 1 ? question mark used as a wildcard in
97
+ * Unix, Windows and AmigaOS; marks a single character. Allowed in Unix
98
+ * filenames, see Note 1 % percent used as a wildcard in RT-11; marks a single
99
+ * character. asterisk or star used as a wildcard in Unix, MS-DOS, RT-11, VMS
100
+ * and Windows. Marks any sequence of characters (Unix, Windows, later versions
101
+ * of MS-DOS) or any sequence of characters in either the basename or extension
102
+ * (thus "*.*" in early versions of MS-DOS means "all files". Allowed in Unix
103
+ * filenames, see note 1 : colon used to determine the mount point / drive on
104
+ * Windows; used to determine the virtual device or physical device such as a
105
+ * drive on AmigaOS, RT-11 and VMS; used as a pathname separator in classic Mac
106
+ * OS. Doubled after a name on VMS, indicates the DECnet nodename (equivalent to
107
+ * a NetBIOS (Windows networking) hostname preceded by "\\".) | vertical bar or
108
+ * pipe designates software pipelining in Unix and Windows; allowed in Unix
113
109
* filenames, see Note 1 " quote used to mark beginning and end of filenames
114
110
* containing spaces in Windows, see Note 1 < less than used to redirect input,
115
111
* allowed in Unix filenames, see Note 1 > greater than used to redirect output,
116
- * allowed in Unix filenames, see Note 1 . period or dot
112
+ * allowed in Unix filenames, see Note 1 . period or dot
117
113
*
118
- * @param name the string that needs to be checked
114
+ * @param name
115
+ * the string that needs to be checked
119
116
* @return a name safe to create files or folders
120
117
*/
121
118
public static String MakeNameCompileSafe (String name ) {
@@ -127,7 +124,6 @@ public static String MakeNameCompileSafe(String name) {
127
124
return ret ;
128
125
}
129
126
130
-
131
127
/**
132
128
* Logs the status information if status is OK then nothing happens
133
129
*
@@ -145,23 +141,26 @@ public static void log(IStatus status) {
145
141
stMan .handle (status , style );
146
142
break ;
147
143
}
148
- case SLOEBER_STATUS_DEBUG :
144
+ case SLOEBER_STATUS_DEBUG :
149
145
// break;//remove break to add debugging
150
- default :
146
+ default :
151
147
Activator .getDefault ().getLog ().log (status );
152
148
}
153
149
}
154
150
155
-
156
151
/**
157
152
*
158
153
* Provides the build environment variable based on project and string This
159
154
* method does not add any knowledge.(like adding A.)
160
155
*
161
- * @param project the project that contains the environment variable
162
- * @param configName the project configuration to use
163
- * @param envName the key that describes the variable
164
- * @param defaultvalue The return value if the variable is not found.
156
+ * @param project
157
+ * the project that contains the environment variable
158
+ * @param configName
159
+ * the project configuration to use
160
+ * @param envName
161
+ * the key that describes the variable
162
+ * @param defaultvalue
163
+ * The return value if the variable is not found.
165
164
* @return The expanded build environment variable
166
165
*/
167
166
static public String getBuildEnvironmentVariable (IProject project , String configName , String envName ,
@@ -175,10 +174,13 @@ static public String getBuildEnvironmentVariable(IProject project, String config
175
174
* Provides the build environment variable based on project and string This
176
175
* method does not add any knowledge.(like adding A.)
177
176
*
178
- * @param project the project that contains the environment variable
177
+ * @param project
178
+ * the project that contains the environment variable
179
179
*
180
- * @param envName the key that describes the variable
181
- * @param defaultvalue The return value if the variable is not found.
180
+ * @param envName
181
+ * the key that describes the variable
182
+ * @param defaultvalue
183
+ * The return value if the variable is not found.
182
184
* @return The expanded build environment variable
183
185
*/
184
186
static public String getBuildEnvironmentVariable (IProject project , String envName , String defaultvalue ) {
@@ -191,9 +193,12 @@ static public String getBuildEnvironmentVariable(IProject project, String envNam
191
193
* Provides the build environment variable based on project and string This
192
194
* method does not add any knowledge.(like adding A.)
193
195
*
194
- * @param project the project that contains the environment variable
195
- * @param envName the key that describes the variable
196
- * @param defaultvalue The return value if the variable is not found.
196
+ * @param project
197
+ * the project that contains the environment variable
198
+ * @param envName
199
+ * the key that describes the variable
200
+ * @param defaultvalue
201
+ * The return value if the variable is not found.
197
202
* @return The expanded build environment variable
198
203
*/
199
204
static public String getBuildEnvironmentVariable (ICConfigurationDescription configurationDescription ,
@@ -229,25 +234,24 @@ public static IPath getWorkspaceRoot() {
229
234
* @return modified string or the original
230
235
*/
231
236
public static String makePathEnvironmentString (IPath path ) {
232
- return path .toOSString ().replace (sloeberHomePathToOSString , SLOEBER_HOME_VAR );
233
- }
234
-
235
- public static String makePathEnvironmentString (File file ) {
236
- return file .getPath ().replace (sloeberHomePathToOSString , SLOEBER_HOME_VAR );
237
+ return path .toOSString ().replace (sloeberHomePathToString , SLOEBER_HOME_VAR );
237
238
}
238
239
239
240
public static String makePathVersionString (File file ) {
240
- String osPathString = file .getPath ();
241
- IPath path = new Path (osPathString );
242
- return path .toString ().replace (sloeberHomePathToString , SLOEBER_HOME_VAR );
241
+ return file .getPath ().replace (sloeberHomePathToString , SLOEBER_HOME_VAR );
243
242
}
244
243
244
+ /**
245
+ * Support for the environment variable SLOBER_HOME
246
+ *
247
+ * @param file
248
+ * @return
249
+ */
245
250
public static File resolvePathEnvironmentString (File file ) {
246
- String retString = file .getPath ().replace (SLOEBER_HOME_VAR , sloeberHomePathToOSString );
251
+ String retString = file .getPath ().replace (SLOEBER_HOME_VAR , sloeberHomePathToString );
247
252
return new File (retString );
248
253
}
249
254
250
-
251
255
/**
252
256
* Converts a name to a tagged environment variable if variableName ="this" the
253
257
* output is "${this}"
@@ -273,5 +277,4 @@ static public String getOldWayEnvVar(ICConfigurationDescription confDesc, String
273
277
getBuildEnvironmentVariable (confDesc , envName .toUpperCase (), EMPTY , true ), true );
274
278
}
275
279
276
-
277
280
}
0 commit comments