上一次我装Myeclipse的时候还没事,E:\Program Files\Genuitec\MyEclipse 7.1\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
这个文件夹还有,里面的文件也有,这次我重装了系统,再装MyEclipse的时候发现E:\Program Files\Genuitec\MyEclipse 7.1\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
不见了,不只文件不见了,org.eclipse.equinox.simpleconfigurator文件夹都没了,怎么回事啊?我装错步骤了?也不对啊。
请大大们帮忙!
这个文件夹还有,里面的文件也有,这次我重装了系统,再装MyEclipse的时候发现E:\Program Files\Genuitec\MyEclipse 7.1\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info
不见了,不只文件不见了,org.eclipse.equinox.simpleconfigurator文件夹都没了,怎么回事啊?我装错步骤了?也不对啊。
请大大们帮忙!
最后祝你好运吧!import java.io.File;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;public class CreatePluginsConfig { private String path = "";
private String eclipsePath = "";
File f;
FileOutputStream fos; public CreatePluginsConfig(String path, String eclipsePath) {
this.path = path;
this.eclipsePath = eclipsePath;
} public void print() {
List<Object> list = getFileList(path);
if (list == null) {
return;
}
int length = list.size();
for (int i = 0; i < length; i++) {
String result = "";
String thePath = getFormatPath(getString(list.get(i)));
File file = new File(thePath);
if (file.isDirectory()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
String[] filenames = fileName.split("_");
String filename1 = filenames[0];
String filename2 = filenames[1];
result = filename1 + "," + filename2 + ",file:/" + path + "\\"
+ fileName + "\\,4,false";
System.out.println(result);
} else if (file.isFile()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
String filename1 = fileName.substring(0, last);
String filename2 = fileName.substring(last + 1, fileName
.length() - 4);
result = filename1 + "," + filename2 + ",file:/" + path + "\\"
+ fileName + ",4,false";
System.out.println(result);
} try {
f = new File(eclipsePath);
if (!f.exists()) {
if (!f.mkdir()) {
throw new Exception("文件夹不存在,创建失败!");
}
}
f = new File(eclipsePath + "\\bundles.info");
if (!file.exists())
if (!file.createNewFile())
throw new Exception("文件不存在,创建失败!");
fos = new FileOutputStream(f, true);
fos.write((result + "\r\n").getBytes()); fos.flush();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
} public List<Object> getFileList(String path) {
path = getFormatPath(path);
path = path + "/";
File filePath = new File(path);
if (!filePath.isDirectory()) {
return null;
}
String[] filelist = filePath.list();
List<Object> filelistFilter = new ArrayList<Object>(); for (int i = 0; i < filelist.length; i++) {
String tempfilename = getFormatPath(path + filelist[i]);
filelistFilter.add(tempfilename);
}
return filelistFilter;
} public String getString(Object object) {
if (object == null) {
return "";
}
return String.valueOf(object);
} public String getFormatPath(String path) {
path = path.replaceAll("\\\\", "/");
path = path.replaceAll("//", "/");
return path;
} public static void main(String[] args) {
/* 插件存放的目录 */
String pluginPathString = "D:\\Program Files\\Genuitec\\eclipse\\plugins"; /* myeclipse的目录 */
String myeclipsePathString = "D:\\Program Files\\Genuitec\\MyEclipse 7.1\\configuration\\org.eclipse.equinox.simpleconfigurator"; new CreatePluginsConfig(pluginPathString, myeclipsePathString).print();
}
/*
* #
* C:\ProgramFiles\Genuitec\MyEclipse7.1\configuration\org.eclipse.equinox.
* # simpleconfigurator\bundles.info #
*/
}