1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00
This commit is contained in:
David Inglis 2006-05-15 14:07:07 +00:00
parent a8d10ae99f
commit b2265fc025

View file

@ -49,6 +49,7 @@ import org.eclipse.core.runtime.SubProgressMonitor;
* @author vhirsl * @author vhirsl
*/ */
public class DefaultRunSIProvider implements IExternalScannerInfoProvider { public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
private static final String EXTERNAL_SI_PROVIDER_ERROR = "ExternalScannerInfoProvider.Provider_Error"; //$NON-NLS-1$ private static final String EXTERNAL_SI_PROVIDER_ERROR = "ExternalScannerInfoProvider.Provider_Error"; //$NON-NLS-1$
private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$ private static final String EXTERNAL_SI_PROVIDER_CONSOLE_ID = MakeCorePlugin.getUniqueIdentifier() + ".ExternalScannerInfoProviderConsole"; //$NON-NLS-1$
private static final String LANG_ENV_VAR = "LANG"; //$NON-NLS-1$ private static final String LANG_ENV_VAR = "LANG"; //$NON-NLS-1$
@ -164,32 +165,31 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
protected boolean initialize() { protected boolean initialize() {
IProject currProject = resource.getProject(); IProject currProject = resource.getProject();
IMakeBuilderInfo info; IPath workingDirectory = null;
try { try {
info = MakeCorePlugin.createBuildInfo(resource.getProject(), MakeBuilder.BUILDER_ID); IMakeBuilderInfo info = MakeCorePlugin.createBuildInfo(resource.getProject(), MakeBuilder.BUILDER_ID);
} catch (CoreException e) { workingDirectory = info.getBuildLocation();
// TODO Auto-generated catch block if (!workingDirectory.isEmpty()) {
e.printStackTrace();
throw new RuntimeException(e);
}
IPath workingDirectory = info.getBuildLocation();
if (workingDirectory != null && !workingDirectory.isEmpty()) {
IResource res = currProject.getParent().findMember(workingDirectory); IResource res = currProject.getParent().findMember(workingDirectory);
if (res instanceof IContainer && res.exists()) { if (res instanceof IContainer && res.exists()) {
workingDirectory = res.getLocation(); workingDirectory = res.getLocation();
} }
} }
if (workingDirectory == null) { } catch (CoreException e) {
// TODO - FIXME
// ignore, we need to change this so that the correct
// working directory can be provided
}
if (workingDirectory == null || workingDirectory.isEmpty()) {
workingDirectory = currProject.getLocation(); workingDirectory = currProject.getLocation();
} }
//fWorkingDirectory = resource.getProject().getLocation(); // fWorkingDirectory = resource.getProject().getLocation();
fWorkingDirectory = workingDirectory; fWorkingDirectory = workingDirectory;
fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId)); fCompileCommand = new Path(buildInfo.getProviderRunCommand(providerId));
fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$ fCompileArguments = ScannerConfigUtil.tokenizeStringWithQuotes(buildInfo.getProviderRunArguments(providerId), "\"");//$NON-NLS-1$
return (fCompileCommand != null); return (fCompileCommand != null);
} }
/** /**
* Add additional arguments. For example: tso - target specific options * Add additional arguments. For example: tso - target specific options
* Base class implementation returns compileArguments. * Base class implementation returns compileArguments.
@ -239,10 +239,10 @@ public class DefaultRunSIProvider implements IExternalScannerInfoProvider {
Enumeration names = props.propertyNames(); Enumeration names = props.propertyNames();
if (names != null) { if (names != null) {
while (names.hasMoreElements()) { while (names.hasMoreElements()) {
String key = (String) names.nextElement(); String key = (String)names.nextElement();
envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$ envList.add(key + "=" + props.getProperty(key)); //$NON-NLS-1$
} }
env = (String[]) envList.toArray(new String[envList.size()]); env = (String[])envList.toArray(new String[envList.size()]);
} }
return env; return env;
} }