~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/gnu/GCCScannerConfigUtil.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2011-10-06 21:15:04 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111006211504-8dutmljjih0zikfv
Tags: 8.0.1-1
* New upstream release.
* Split the JNI packages into a separate architecture dependent
  package and made eclipse-cdt architecture independent.
* Install JNI libraries into multiarch aware location
* Bumped Standards-Version to 3.9.2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
7
 *
 
8
 * Contributors:
 
9
 * IBM - Initial API and implementation
 
10
 *******************************************************************************/
 
11
package org.eclipse.cdt.make.internal.core.scannerconfig.gnu;
 
12
 
 
13
import java.io.File;
 
14
import java.io.FileOutputStream;
 
15
import java.io.IOException;
 
16
 
 
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;
 
23
 
 
24
/**
 
25
 * GCC related utility class
 
26
 * 
 
27
 * @author vhirsl
 
28
 */
 
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$
 
32
 
 
33
        public static void createSpecs() {
 
34
                IPath path = MakeCorePlugin.getWorkingDirectory();
 
35
                try {
 
36
                        createSpecsFile(path, CPP_SPECS_FILE);
 
37
                        createSpecsFile(path, C_SPECS_FILE);
 
38
                } catch (CoreException e) {
 
39
                        MakeCorePlugin.log(e);
 
40
                }
 
41
        }
 
42
 
 
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()) {
 
47
                        try {
 
48
                                FileOutputStream file = new FileOutputStream(specsFile);
 
49
                                file.write('\n');
 
50
                                file.close();
 
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$
 
55
                        }
 
56
                }
 
57
        }
 
58
}