Skip to content

Commit

Permalink
adding all of the substitutions for the config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Bad Name authored and Kevin Bad Name committed Jun 27, 2024
1 parent 7b4df2c commit 4b75be5
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public void launch(File file, Button advanced) {
Map<String, String> env = getEnvironment("eclipse");
HashMap<String, String> environment = new HashMap<>();;
environment.putAll(env);
File settings=new File(ws+delim()+"bowler-settings.epf");
File settings=new File(ScriptingEngine.getWorkspace().getAbsolutePath()+delim()+"bowler-settings.epf");
File java=DownloadManager.getConfigExecutable("java8", null);
if(!settings.exists()) {
if(!wsDir.exists())
Expand All @@ -189,19 +189,18 @@ public void launch(File file, Button advanced) {
"settingsTEMPLATE.epf");
try {
String template =FileUtils.readFileToString(prefssource, StandardCharsets.UTF_8);
template=template.replace("MYWORKSPACES",getEclipseWorkspace());
template=template.replace("MYJAVAHOME",java.getAbsolutePath());
template=template.replace("MYWORKSPACES",eclipseSanatize(getEclipseWorkspace()));
template=template.replace("MYJAVAHOME",eclipseSanatize(java.getAbsolutePath()));
FileUtils.write(settings, template, StandardCharsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
}
environment.put("JAVA_HOME", java.getAbsolutePath());
environment.put("ECLIPSE_PREFERENCE_FILE", settings.getAbsolutePath());
if(!isEclipseOpen( ws)) {
File exeFile = getConfigExecutable("eclipse",null);
String eclipseEXE = exeFile.getAbsolutePath();

environment.put("ECLIPSE_PREFERENCE_FILE", settings.getAbsolutePath());
run(environment,this,ScriptingEngine.getWorkspace() ,System.out, Arrays.asList(eclipseEXE, "-data", ws));
while (!isEclipseOpen( ws)) {
try {
Expand Down Expand Up @@ -248,6 +247,15 @@ public void launch(File file, Button advanced) {
}).start();
}

private CharSequence eclipseSanatize(String absolutePath) {
if(isWin()) {
// this replaces one slash with 2 slashes, just trust me
absolutePath=absolutePath.replaceAll("\\\\", "\\\\\\\\");
absolutePath=absolutePath.replaceAll(":", "\\\\:");
}
return absolutePath;
}

public static String getEclipseWorkspace() {
return ScriptingEngine.getWorkspace().getAbsolutePath() + delim() + "eclipse-bowler-workspace";
}
Expand Down

0 comments on commit 4b75be5

Please sign in to comment.