fix get cmdline error

pull/1/head
cfig 9 years ago
parent d7ce4d65aa
commit ef64e70941

@ -6,6 +6,8 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
def workdir='build/unzip_boot' def workdir='build/unzip_boot'
@ -181,16 +183,24 @@ String getRamdiskConfig(String inWorkdir, String inKey) {
return "0x0"; return "0x0";
} }
try { try {
Properties prop = new Properties(); BufferedReader br = new BufferedReader(new FileReader(inWorkdir + "/bootimg.cfg"));
InputStream fis = new FileInputStream(inWorkdir+ "/bootimg.cfg") String item;
prop.load(fis); while (true) {
ret = prop.getProperty(inKey); item = br.readLine();
if (fis != null) { if (null == item) {
fis.close(); break;
}
Pattern r = Pattern.compile("(?<=" + inKey + " = ).*");
Matcher m = r.matcher(item);
if (m.find()) {
ret = m.group(0)
}
} }
} catch (IOException e) { } catch (Exception e) {
throw new RuntimeException("IOException"); e.printStackTrace();
throw new RuntimeException("Fatal Error");
} }
return ret; return ret;
} }

Loading…
Cancel
Save