mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 07:55:24 +02:00
Bug 409915 - LLVM support throws NPE
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
parent
10feb88f56
commit
7dd2b7922d
2 changed files with 24 additions and 13 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland.
|
* Copyright (c) 2010, 2013 Nokia Siemens Networks Oyj, Finland.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -9,6 +9,7 @@
|
||||||
* Nokia Siemens Networks - initial implementation
|
* Nokia Siemens Networks - initial implementation
|
||||||
* Leo Hippelainen - Initial implementation
|
* Leo Hippelainen - Initial implementation
|
||||||
* Petri Tuononen - Initial implementation
|
* Petri Tuononen - Initial implementation
|
||||||
|
* Marc-Andre Laperle (Ericsson)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.managedbuilder.llvm.ui;
|
package org.eclipse.cdt.managedbuilder.llvm.ui;
|
||||||
|
|
||||||
|
@ -313,16 +314,27 @@ public class LlvmEnvironmentVariableSupplier implements
|
||||||
public static String getMinGWStdLib() {
|
public static String getMinGWStdLib() {
|
||||||
//get mingw bin path
|
//get mingw bin path
|
||||||
IPath mingwBinPath = MingwEnvironmentVariableSupplier.getBinDir();
|
IPath mingwBinPath = MingwEnvironmentVariableSupplier.getBinDir();
|
||||||
StringBuilder sB = new StringBuilder(mingwBinPath.toOSString());
|
if (mingwBinPath != null) {
|
||||||
//drop bin
|
StringBuilder sB = new StringBuilder(mingwBinPath.toOSString());
|
||||||
sB.delete(sB.length()-3, sB.length());
|
// drop bin
|
||||||
//append mingw lib subdir
|
if (sB.length() >= 3) {
|
||||||
sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$
|
sB.delete(sB.length() - 3, sB.length());
|
||||||
//get all files in the directory
|
// append mingw lib subdir
|
||||||
File f = new File(sB.toString());
|
sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$
|
||||||
//append the first dir
|
// get all files in the directory
|
||||||
sB.append(f.list()[0]);
|
File f = new File(sB.toString());
|
||||||
return sB.toString();
|
if (f.isDirectory()) {
|
||||||
|
String[] list = f.list();
|
||||||
|
if (list.length > 0) {
|
||||||
|
// append the first dir
|
||||||
|
sB.append(list[0]);
|
||||||
|
return sB.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -301,12 +301,11 @@ public class LlvmPreferenceStore {
|
||||||
|
|
||||||
public static void addMinGWStdLib() {
|
public static void addMinGWStdLib() {
|
||||||
String path = LlvmEnvironmentVariableSupplier.getMinGWStdLib();
|
String path = LlvmEnvironmentVariableSupplier.getMinGWStdLib();
|
||||||
String lib = "stdc++"; //$NON-NLS-1$
|
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
//add to preference store
|
//add to preference store
|
||||||
appendLibraryPath(path);
|
appendLibraryPath(path);
|
||||||
// ProjectIndex.rebuiltIndex(proj);
|
// ProjectIndex.rebuiltIndex(proj);
|
||||||
appendLibrary(lib);
|
appendLibrary("stdc++"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue