Skip to content

Commit 2eea055

Browse files
committed
#580: fix preferXpacksBin not in workspace
1 parent ed5cd58 commit 2eea055

File tree

3 files changed

+47
-49
lines changed

3 files changed

+47
-49
lines changed

plugins/org.eclipse.embedcdt.debug.gdbjtag.qemu.core/src/org/eclipse/embedcdt/debug/gdbjtag/qemu/core/Configuration.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,14 @@ public static String getGdbServerCommand(ILaunchConfiguration configuration, Str
104104
}
105105

106106
if (project != null) {
107-
IPath projectPath = project.getWorkspace().getRoot().getLocation()
108-
.append(project.getFullPath());
109-
IPath serverPath = projectPath.append("xpacks").append(".bin").append(name);
107+
IPath xpackBinPath = project.getFolder("xpacks").getFolder(".bin").getLocation();
108+
IPath serverPath = xpackBinPath.append(name);
110109

111110
if (serverPath.toFile().exists()) {
112111
executable = serverPath.toString();
113112
} else {
114113
if (EclipseUtils.isWindows()) {
115-
serverPath = projectPath.append("xpacks").append(".bin").append(name + ".cmd");
114+
serverPath = xpackBinPath.append(name + ".cmd");
116115
if (serverPath.toFile().exists()) {
117116
executable = serverPath.toString();
118117
}

plugins/org.eclipse.embedcdt.managedbuild.cross.arm.core/src/org/eclipse/embedcdt/managedbuild/cross/arm/core/EnvironmentVariableSupplier.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
3333
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
3434
import org.eclipse.core.resources.IProject;
35-
import org.eclipse.core.runtime.IPath;
3635
import org.eclipse.core.runtime.Platform;
3736
import org.eclipse.embedcdt.internal.managedbuild.cross.arm.core.Activator;
3837
import org.eclipse.embedcdt.managedbuild.cross.core.preferences.PersistentPreferences;
@@ -94,10 +93,8 @@ public static PathEnvironmentVariable create(IConfiguration configuration) {
9493

9594
List<String> path = new ArrayList<>();
9695
if (preferXpacksBin) {
97-
IPath projectPath = project.getWorkspace().getRoot().getLocation().append(project.getFullPath());
98-
IPath xpackBinPath = projectPath.append("xpacks").append(".bin");
99-
100-
path.add(xpackBinPath.toOSString());
96+
String xpackBinPath = project.getFolder("xpacks").getFolder(".bin").getLocation().toOSString();
97+
path.add(xpackBinPath);
10198
}
10299

103100
// Get the build tools path from the common store.
@@ -117,28 +114,31 @@ public static PathEnvironmentVariable create(IConfiguration configuration) {
117114
path.add(buildToolsPath);
118115
}
119116

120-
IOption optionId;
121-
optionId = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_ID); // $NON-NLS-1$
122-
String toolchainId = (String) optionId.getValue();
123-
124-
IOption optionName;
125-
optionName = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_NAME); // $NON-NLS-1$
126-
String toolchainName = (String) optionName.getValue();
127-
128-
String toolchainPath = "";
129-
130-
// Get the toolchain path from this plug-in store.
131-
PersistentPreferences persistentPreferences = Activator.getInstance().getPersistentPreferences();
132-
// Get the most specific toolchain path (project, workspace,
133-
// Eclipse, defaults).
134-
toolchainPath = persistentPreferences.getToolchainPath(toolchainId, toolchainName, project);
135-
if (toolchainPath.isEmpty()) {
136-
// Try to get from original gnuarmeclipse store.
137-
toolchainPath = deprecatedPersistentPreferences.getToolchainPath(toolchainId, toolchainName, project);
138-
}
117+
if (!preferXpacksBin) {
118+
IOption optionId;
119+
optionId = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_ID); // $NON-NLS-1$
120+
String toolchainId = (String) optionId.getValue();
121+
122+
IOption optionName;
123+
optionName = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_NAME); // $NON-NLS-1$
124+
String toolchainName = (String) optionName.getValue();
125+
126+
String toolchainPath = "";
127+
128+
// Get the toolchain path from this plug-in store.
129+
PersistentPreferences persistentPreferences = Activator.getInstance().getPersistentPreferences();
130+
// Get the most specific toolchain path (project, workspace,
131+
// Eclipse, defaults).
132+
toolchainPath = persistentPreferences.getToolchainPath(toolchainId, toolchainName, project);
133+
if (toolchainPath.isEmpty()) {
134+
// Try to get from original gnuarmeclipse store.
135+
toolchainPath = deprecatedPersistentPreferences.getToolchainPath(toolchainId, toolchainName,
136+
project);
137+
}
139138

140-
if (!toolchainPath.isEmpty()) {
141-
path.add(toolchainPath);
139+
if (!toolchainPath.isEmpty()) {
140+
path.add(toolchainPath);
141+
}
142142
}
143143

144144
if (!path.isEmpty()) {

plugins/org.eclipse.embedcdt.managedbuild.cross.riscv.core/src/org/eclipse/embedcdt/managedbuild/cross/riscv/core/EnvironmentVariableSupplier.java

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
3434
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
3535
import org.eclipse.core.resources.IProject;
36-
import org.eclipse.core.runtime.IPath;
3736
import org.eclipse.core.runtime.Platform;
3837
import org.eclipse.embedcdt.internal.managedbuild.cross.riscv.core.Activator;
3938
import org.eclipse.embedcdt.managedbuild.cross.core.preferences.PersistentPreferences;
@@ -95,10 +94,8 @@ public static PathEnvironmentVariable create(IConfiguration configuration) {
9594

9695
List<String> path = new ArrayList<>();
9796
if (preferXpacksBin) {
98-
IPath projectPath = project.getWorkspace().getRoot().getLocation().append(project.getFullPath());
99-
IPath xpackBinPath = projectPath.append("xpacks").append(".bin");
100-
101-
path.add(xpackBinPath.toOSString());
97+
String xpackBinPath = project.getFolder("xpacks").getFolder(".bin").getLocation().toOSString();
98+
path.add(xpackBinPath);
10299
}
103100

104101
// Get the build tools path from the common store.
@@ -112,24 +109,26 @@ public static PathEnvironmentVariable create(IConfiguration configuration) {
112109
path.add(buildToolsPath);
113110
}
114111

115-
IOption optionId;
116-
optionId = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_ID); // $NON-NLS-1$
117-
String toolchainId = (String) optionId.getValue();
112+
if (!preferXpacksBin) {
113+
IOption optionId;
114+
optionId = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_ID); // $NON-NLS-1$
115+
String toolchainId = (String) optionId.getValue();
118116

119-
IOption optionName;
120-
optionName = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_NAME); // $NON-NLS-1$
121-
String toolchainName = (String) optionName.getValue();
117+
IOption optionName;
118+
optionName = toolchain.getOptionBySuperClassId(Option.OPTION_TOOLCHAIN_NAME); // $NON-NLS-1$
119+
String toolchainName = (String) optionName.getValue();
122120

123-
String toolchainPath = "";
121+
String toolchainPath = "";
124122

125-
// Get the toolchain path from this plug-in store.
126-
PersistentPreferences persistentPreferences = Activator.getInstance().getPersistentPreferences();
127-
// Get the most specific toolchain path (project, workspace,
128-
// Eclipse, defaults).
129-
toolchainPath = persistentPreferences.getToolchainPath(toolchainId, toolchainName, project);
123+
// Get the toolchain path from this plug-in store.
124+
PersistentPreferences persistentPreferences = Activator.getInstance().getPersistentPreferences();
125+
// Get the most specific toolchain path (project, workspace,
126+
// Eclipse, defaults).
127+
toolchainPath = persistentPreferences.getToolchainPath(toolchainId, toolchainName, project);
130128

131-
if (!toolchainPath.isEmpty()) {
132-
path.add(toolchainPath);
129+
if (!toolchainPath.isEmpty()) {
130+
path.add(toolchainPath);
131+
}
133132
}
134133

135134
if (!path.isEmpty()) {

0 commit comments

Comments
 (0)