@@ -110,18 +110,23 @@ private static String getSloeberHome() {
110110 * allowed in Unix filenames, see Note 1 > greater than used to redirect output,
111111 * allowed in Unix filenames, see Note 1 . period or dot
112112 *
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
114118 *
115119 * @param name
116120 * the string that needs to be checked
117121 * @return a name safe to create files or folders
118122 */
119123 public static String makeNameCompileSafe (String name ) {
120- char [] badChars = { ' ' , '/' , '.' , ':' , '\\' , '(' , ')' , '*' , '?' , '%' , '|' , '<' , '>' , ',' , '-' , '#' , '"' , '&' };
124+ char [] badChars = { ' ' , '/' , '.' , ':' , '\\' , '(' , ')' , '*' , '?' , '%' , '|' , '<' , '>' , ',' , '-' , '#' , '"' , '&' , '+' , '@' , ';' };
121125 String ret = name .trim ();
122126 for (char curchar : badChars ) {
123127 ret = ret .replace (curchar , '_' );
124128 }
129+ ret = ret .replace ("__" , "_" ); //$NON-NLS-1$ //$NON-NLS-2$
125130 return ret ;
126131 }
127132
@@ -176,8 +181,8 @@ static public String getBuildEnvironmentVariable(ISloeberConfiguration sloeberCo
176181 static public String getBuildEnvironmentVariable (ISloeberConfiguration sloeberConf , String envName ,
177182 String defaultvalue , boolean expanded ) {
178183 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 );
181186// IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager();
182187// try {
183188// ICConfigurationDescription configurationDescription = sloeberConf.getAutoBuildDesc()
@@ -212,9 +217,9 @@ public static IPath getWorkspaceRoot() {
212217 * @return modified string or the original
213218 */
214219 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+ }
218223 return file .toString ();
219224 }
220225
@@ -228,9 +233,9 @@ public static File resolvePathEnvironmentString(File file) {
228233
229234 String retString = file .getPath ();
230235 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);
234239 }
235240 return new File (retString );
236241 }
@@ -252,7 +257,7 @@ public static void deleteDirectory(org.eclipse.core.runtime.IPath directory) thr
252257
253258 public static void deleteDirectory (Path directory ) throws IOException {
254259 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 );
256261 }
257262 }
258263
0 commit comments