@@ -110,18 +110,23 @@ private static String getSloeberHome() {
110
110
* allowed in Unix filenames, see Note 1 > greater than used to redirect output,
111
111
* allowed in Unix filenames, see Note 1 . period or dot
112
112
*
113
- * Though " and & are allowed they confuse cmd commands
113
+ *
114
+ * Though { " & + @ } ; are allowed according to the above info they do confuse cmd
115
+ * commands so I also remove them
116
+ *
117
+ * multiple underscores are also concatenated to 1 underscore
114
118
*
115
119
* @param name
116
120
* the string that needs to be checked
117
121
* @return a name safe to create files or folders
118
122
*/
119
123
public static String makeNameCompileSafe (String name ) {
120
- char [] badChars = { ' ' , '/' , '.' , ':' , '\\' , '(' , ')' , '*' , '?' , '%' , '|' , '<' , '>' , ',' , '-' , '#' , '"' , '&' };
124
+ char [] badChars = { ' ' , '/' , '.' , ':' , '\\' , '(' , ')' , '*' , '?' , '%' , '|' , '<' , '>' , ',' , '-' , '#' , '"' , '&' , '+' , '@' , ';' };
121
125
String ret = name .trim ();
122
126
for (char curchar : badChars ) {
123
127
ret = ret .replace (curchar , '_' );
124
128
}
129
+ ret = ret .replace ("__" , "_" ); //$NON-NLS-1$ //$NON-NLS-2$
125
130
return ret ;
126
131
}
127
132
@@ -176,8 +181,8 @@ static public String getBuildEnvironmentVariable(ISloeberConfiguration sloeberCo
176
181
static public String getBuildEnvironmentVariable (ISloeberConfiguration sloeberConf , String envName ,
177
182
String defaultvalue , boolean expanded ) {
178
183
if (sloeberConf != null ) {
179
- IAutoBuildConfigurationDescription autoDesc = sloeberConf .getAutoBuildDesc ();
180
- return AutoBuildCommon .getVariableValue (envName , defaultvalue , expanded , autoDesc );
184
+ IAutoBuildConfigurationDescription autoDesc = sloeberConf .getAutoBuildDesc ();
185
+ return AutoBuildCommon .getVariableValue (envName , defaultvalue , expanded , autoDesc );
181
186
// IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
182
187
// try {
183
188
// ICConfigurationDescription configurationDescription = sloeberConf.getAutoBuildDesc()
@@ -212,9 +217,9 @@ public static IPath getWorkspaceRoot() {
212
217
* @return modified string or the original
213
218
*/
214
219
public static String makePathVersionString (File file ) {
215
- if (sloeberHomePath .isPrefixOf (IPath .fromFile (file ))) {
216
- return SLOEBER_HOME_VAR +SLACH +IPath .fromFile (file ).makeRelativeTo (sloeberHomePath ).toString ();
217
- }
220
+ if (sloeberHomePath .isPrefixOf (IPath .fromFile (file ))) {
221
+ return SLOEBER_HOME_VAR +SLACH +IPath .fromFile (file ).makeRelativeTo (sloeberHomePath ).toString ();
222
+ }
218
223
return file .toString ();
219
224
}
220
225
@@ -228,9 +233,9 @@ public static File resolvePathEnvironmentString(File file) {
228
233
229
234
String retString = file .getPath ();
230
235
if (retString .startsWith (SLOEBER_HOME_VAR )) {
231
- retString =retString .replace (SLOEBER_HOME_VAR , EMPTY_STRING );
232
- return sloeberHomePath .append (retString ).toFile ();
233
- //.replace(SLOEBER_HOME_VAR, sloeberHomePathToString);
236
+ retString =retString .replace (SLOEBER_HOME_VAR , EMPTY_STRING );
237
+ return sloeberHomePath .append (retString ).toFile ();
238
+ //.replace(SLOEBER_HOME_VAR, sloeberHomePathToString);
234
239
}
235
240
return new File (retString );
236
241
}
@@ -252,7 +257,7 @@ public static void deleteDirectory(org.eclipse.core.runtime.IPath directory) thr
252
257
253
258
public static void deleteDirectory (Path directory ) throws IOException {
254
259
try ( Stream <Path > stream = Files .walk (directory )){
255
- stream .sorted (Comparator .reverseOrder ()).map (Path ::toFile ).forEach (File ::delete );
260
+ stream .sorted (Comparator .reverseOrder ()).map (Path ::toFile ).forEach (File ::delete );
256
261
}
257
262
}
258
263
0 commit comments