1
/*******************************************************************************
2
* Copyright (c) 2004, 2007 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM - Initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
14
import java.io.FileOutputStream;
15
import java.io.IOException;
17
import org.eclipse.cdt.make.core.MakeCorePlugin;
18
import org.eclipse.cdt.make.internal.core.MakeMessages;
19
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.core.runtime.IStatus;
22
import org.eclipse.core.runtime.Status;
25
* GCC related utility class
29
public class GCCScannerConfigUtil {
30
public static final String CPP_SPECS_FILE = "specs.cpp"; //$NON-NLS-1$
31
public static final String C_SPECS_FILE = "specs.c"; //$NON-NLS-1$
33
public static void createSpecs() {
34
IPath path = MakeCorePlugin.getWorkingDirectory();
36
createSpecsFile(path, CPP_SPECS_FILE);
37
createSpecsFile(path, C_SPECS_FILE);
38
} catch (CoreException e) {
39
MakeCorePlugin.log(e);
43
private static void createSpecsFile(IPath path, String fileName) throws CoreException {
44
IPath specs = path.append(fileName);
45
File specsFile = specs.toFile();
46
if (!specsFile.exists()) {
48
FileOutputStream file = new FileOutputStream(specsFile);
51
} catch (IOException e) {
52
throw new CoreException(new Status(IStatus.ERROR,
53
MakeCorePlugin.getUniqueIdentifier(), -1,
54
MakeMessages.getString("GCCScannerConfigUtil.Error_Message"), e)); //$NON-NLS-1$