1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 23:45:23 +02:00

Bug 409915 - LLVM support throws NPE

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
This commit is contained in:
Marc-Andre Laperle 2013-06-08 20:03:25 -04:00
parent 10feb88f56
commit 7dd2b7922d
2 changed files with 24 additions and 13 deletions

View file

@ -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,17 +314,28 @@ 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();
if (mingwBinPath != null) {
StringBuilder sB = new StringBuilder(mingwBinPath.toOSString()); StringBuilder sB = new StringBuilder(mingwBinPath.toOSString());
//drop bin // drop bin
sB.delete(sB.length()-3, sB.length()); if (sB.length() >= 3) {
//append mingw lib subdir sB.delete(sB.length() - 3, sB.length());
// append mingw lib subdir
sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$ sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$
//get all files in the directory // get all files in the directory
File f = new File(sB.toString()); File f = new File(sB.toString());
//append the first dir if (f.isDirectory()) {
sB.append(f.list()[0]); String[] list = f.list();
if (list.length > 0) {
// append the first dir
sB.append(list[0]);
return sB.toString(); return sB.toString();
} }
}
}
}
return null;
}
/** /**
* *

View file

@ -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$
} }
} }