blob: 800fe2bf12935bc0aaf719e440a052c305db8f41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
/*****************************************************************************
* Copyright (c) 2013 Ken Gilmer, Intel Corporation
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ken Gilmer - initial API and implementation
* Ioana Grigoropol (Intel) - adapt class for remote support
*******************************************************************************/
package org.yocto.bc.bitbake;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.yocto.bc.ui.model.ProjectInfo;
/**
* A helper class for ProjectInfo related tasks.
*
* @author kgilmer
*
*/
public class ProjectInfoHelper {
public static final String OEFS_SCHEME = "OEFS://";
public static final String FILE_SCHEME = "file";
public static final String RSE_SCHEME = "rse";
protected static final String DEFAULT_INIT_SCRIPT = "oe-init-build-env";
/**
* @param path
* @return The path to bitbake init script
* @throws IOException
*/
public static String getInitScriptPath(URI uri) throws IOException {
String val = uri.getPath() + "/" + DEFAULT_INIT_SCRIPT;
return val;
}
public static String getProjectName(URI projectRoot) {
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < projects.length; ++i) {
try {
if (projects[i].getLocationURI().equals(projectRoot)) {
return projects[i].getName();
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}
}
|