Modify Module description for binary shell module.
[mirror_edk2.git] / Tools / Source / MigrationTools / org / tianocore / migration / Common.java
CommitLineData
90503bad 1package org.tianocore.migration;\r
2\r
3import java.io.BufferedReader;\r
4import java.io.File;\r
5import java.io.FileReader;\r
6import java.util.regex.Matcher;\r
7import java.util.regex.Pattern;\r
8\r
9public class Common {\r
10 public static String sourcefiletostring(String filename) throws Exception {\r
11 BufferedReader rd = new BufferedReader(new FileReader(filename));\r
12 StringBuffer wholefile = new StringBuffer();\r
13 String line;\r
14 while ((line = rd.readLine()) != null) {\r
15 wholefile.append(line + "\n");\r
16 }\r
17 return wholefile.toString();\r
18 }\r
19\r
20 public static void ensureDir(String objFileWhole) {\r
21 Pattern ptnseparate = Pattern.compile("(.*)\\\\[^\\\\]*");\r
22 Matcher mtrseparate;\r
23 File tempdir;\r
24\r
25 mtrseparate = ptnseparate.matcher(objFileWhole);\r
26 if (mtrseparate.find()) {\r
27 tempdir = new File(mtrseparate.group(1));\r
28 if (!tempdir.exists()) tempdir.mkdirs();\r
29 }\r
30 \r
31 }\r
32}\r