\r
public static final HashMap<ModuleInfo, String> ModuleInfoMap = new HashMap<ModuleInfo, String>();\r
\r
+ private static String startpath = null;\r
+ \r
private static final void mainFlow(ModuleInfo mi) throws Exception {\r
\r
ModuleReader.aimAt(mi);\r
//MigrationTool.ui.yesOrNo("go on replace?");\r
SourceFileReplacer.fireAt(mi); // some adding library actions are taken here,so it must be put before "MsaWriter"\r
\r
- //MigrationTool.ui.yesOrNo("go on delete?");\r
- Common.deleteDir(mi.modulepath + File.separator + "temp");\r
-\r
//MigrationTool.ui.yesOrNo("go on show?");\r
// show result\r
if (MigrationTool.printModuleInfo) {\r
MigrationTool.ui.println(show + hash.size());\r
MigrationTool.ui.println(hash);\r
}\r
-/*\r
+\r
public static final String getTempDir(String modulepath) {\r
- return "C:" + File.separator + "MigrationTool_Temp" + File.separator + modulepath.replaceAll(ui., arg1);\r
+ return "C:" + File.separator + "MigrationTool_Temp" + modulepath.replace(startpath, "");\r
}\r
-*/\r
+\r
private static final String assignOutPutPath(String inputpath) {\r
if (MigrationTool.defaultoutput) {\r
return inputpath.replaceAll(Common.STRSEPARATER, "$1");\r
}\r
\r
public static final void startMigrateAll(String path) throws Exception {\r
+ startpath = path;\r
MigrationTool.ui.println("Project Migration");\r
MigrationTool.ui.println("Copyright (c) 2006, Intel Corporation");\r
+ \r
+ if (new File("C:" + File.separator + "MigrationTool_Temp").exists()) {\r
+ Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");\r
+ }\r
+ \r
Common.toDoAll(path, MigrationTool.class.getMethod("seekModule", String.class), null, null, Common.DIR);\r
\r
Iterator<ModuleInfo> miit = ModuleInfoMap.keySet().iterator();\r
}\r
\r
ModuleInfoMap.clear();\r
+ \r
+ Common.deleteDir("C:" + File.separator + "MigrationTool_Temp");\r
}\r
\r
public static void main(String[] args) throws Exception {\r
public final class ModuleInfo {\r
ModuleInfo(String modulepath) throws Exception {\r
this.modulepath = modulepath;\r
+ this.temppath = MigrationTool.getTempDir(this.modulepath);\r
}\r
\r
public final String modulepath;\r
+ public final String temppath;\r
\r
public String modulename = null;\r
public String guidvalue = null;\r
\r
private final void preProcessModule() throws Exception {\r
// according to .inf file, add extraordinary includes and sourcefiles\r
- Common.dirCopy(mi.modulepath, mi.modulepath + File.separator + "temp"); // collect all Laplace.namechange to here???\r
+ Common.dirCopy(mi.modulepath, mi.temppath); // collect all Laplace.namechange to here???\r
\r
if (!mi.infincludes.isEmpty()) {\r
Iterator<String> it = mi.infincludes.iterator();\r
if (tempincludename.contains("..")) {\r
Matcher mtr = Common.PTNSEPARATER.matcher(tempincludename);\r
if (mtr.find() && !mtr.group(2).matches(".")) {\r
- Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.modulepath + File.separator + "temp", ".h");\r
+ Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath, ".h");\r
} else {\r
- Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.modulepath + File.separator + "temp", ".h");\r
+ Common.oneLevelDirCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1"), mi.temppath, ".h");\r
}\r
}\r
}\r
while (it.hasNext()) {\r
tempsourcename = it.next();\r
if (tempsourcename.contains("..")) {\r
- Common.ensureDir(mi.modulepath + File.separator + "temp" + File.separator + "MT_Parent_Sources");\r
+ Common.ensureDir(mi.temppath + File.separator + "MT_Parent_Sources");\r
Matcher mtr = Common.PTNSEPARATER.matcher(tempsourcename);\r
if (mtr.find()) {\r
- Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.modulepath + File.separator + "temp" + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2));\r
+ Common.fileCopy(mi.modulepath.replaceAll(Common.STRSEPARATER, "$1") + File.separator + mtr.group(2), mi.temppath + File.separator + "MT_Parent_Sources" + File.separator + mtr.group(2));\r
}\r
}\r
}\r
}\r
\r
//CommentOutNonLocalHFile();\r
- Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);\r
+ Common.toDoAll(mi.temppath, this, Common.FILE);\r
\r
parsePreProcessedSourceCode();\r
\r
while (ii.hasNext()) {\r
StringBuffer wholefile = new StringBuffer();\r
ifile = ii.next();\r
- rd = new BufferedReader(new FileReader(mi.modulepath + File.separator + "temp" + File.separator + ifile));\r
+ rd = new BufferedReader(new FileReader(mi.temppath + File.separator + ifile));\r
while ((line = rd.readLine()) != null) {\r
wholefile.append(line + '\n');\r
}\r
\r
//-----------------------------------ForDoAll-----------------------------------//\r
public void run(String filepath) throws Exception {\r
- String name = mi.modulepath + File.separator + "temp" + File.separator + filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");\r
+ String name = mi.temppath + File.separator + filepath.replace(mi.temppath + File.separator, "");\r
commentlaplace.transform(name, name);\r
}\r
\r
\r
//-----------------------------------ForDoAll-----------------------------------//\r
public void run(String filepath) throws Exception {\r
- String inname = filepath.replace(mi.modulepath + File.separator + "temp" + File.separator, "");\r
- String tempinpath = mi.modulepath + File.separator + "temp" + File.separator;\r
+ String inname = filepath.replace(mi.temppath + File.separator, "");\r
+ String tempinpath = mi.temppath + File.separator;\r
String tempoutpath = MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator;\r
\r
Iterator<Common.Laplace> itLaplace = Laplaces.iterator();\r
Laplaces.add(new CLaplace());\r
Laplaces.add(new IdleLaplace());\r
\r
- Common.toDoAll(mi.modulepath + File.separator + "temp", this, Common.FILE);\r
+ Common.toDoAll(mi.temppath, this, Common.FILE);\r
\r
if (!mi.hashr8only.isEmpty()) {\r
addr8only();\r