]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
Turn to Regex in ModuleReader.java
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / ModuleInfo.java
index fa1843f15ea2bea95a6cdb4c6f4261ae4832bc48..5e3bbb50d02878f0ae17f47918d825942ebcb21c 100644 (file)
@@ -81,12 +81,12 @@ public class ModuleInfo {
                dirScan("");\r
                String filename = null;\r
                if (msaorinf.isEmpty()) {\r
-                       ui.println("No .inf nor .msa file found! Tool Halt!");\r
+                       ui.println("No INF nor MSA file found!");\r
                        System.exit(0);\r
                } else {\r
                        filename = ui.choose("Found .inf or .msa file in the module\nChoose one Please", msaorinf.toArray());\r
                }\r
-               ModuleReader mr = new ModuleReader(modulepath, this, db);\r
+               ModuleReader mr = new ModuleReader(modulepath, this, db, ui);\r
                if (filename.contains(".inf")) {\r
                        mr.readInf(filename);\r
                } else if (filename.contains(".msa")) {\r
@@ -99,7 +99,7 @@ public class ModuleInfo {
                new SourceFileReplacer(modulepath, this, db, ui).flush();       // some adding library actions are taken here,so it must be put before "MsaWriter"\r
                \r
                // show result\r
-               if (ui.yesOrNo("Parse Module Information Complete . See details ?")) {\r
+               if (ui.yesOrNo("Parse of the Module Information has completed. View details?")) {\r
                        ui.println("\nModule Information : ");\r
                        ui.println("Entrypoint : " + entrypoint);\r
                        show(protocol, "Protocol : ");\r
@@ -122,27 +122,14 @@ public class ModuleInfo {
                \r
                ui.println("Errors Left : " + db.error);\r
                ui.println("Complete!");\r
-               ui.println("Your R9 module is placed at " + modulepath + File.separator + "result");\r
-               ui.println("Your logfile is placed at " + modulepath);\r
+               ui.println("Your R9 module was placed here: " + modulepath + File.separator + "result");\r
+               ui.println("Your logfile was placed here: " + modulepath);\r
        }\r
        \r
        private void show(Set<String> hash, String show) {\r
                ui.println(show + hash.size());\r
                ui.println(hash);\r
        }\r
-\r
-       public void ensureDir(String objFileWhole) {\r
-               Pattern ptnseparate = Pattern.compile("(.*)\\\\[^\\\\]*");\r
-               Matcher mtrseparate;\r
-               File tempdir;\r
-\r
-               mtrseparate = ptnseparate.matcher(objFileWhole);\r
-               if (mtrseparate.find()) {\r
-                       tempdir = new File(mtrseparate.group(1));\r
-                       if (!tempdir.exists()) tempdir.mkdirs();\r
-               }\r
-               \r
-       }\r
        \r
        // add '//' to all non-local include lines\r
        private void CommentOutNonLocalHFile() throws IOException {\r
@@ -158,7 +145,7 @@ public class ModuleInfo {
                while ( ii.hasNext() ) {\r
                        curFile = ii.next();\r
                        rd = new BufferedReader(new FileReader(modulepath + File.separator + curFile));\r
-                       ensureDir(modulepath + File.separator + "temp" + File.separator + curFile);\r
+                       Common.ensureDir(modulepath + File.separator + "temp" + File.separator + curFile);\r
                        outfile = new PrintWriter(new BufferedWriter(new FileWriter(modulepath + File.separator + "temp" + File.separator + curFile)));\r
                        while ((line = rd.readLine()) != null) {\r
                                if (line.contains("#include")) {\r