Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.BufferedReader;

import java.io.InputStreamReader;

public class Main {
    public static String getSDRoot() {
        String pre = null;
        String root = null;
        try {
            Runtime r = Runtime.getRuntime();
            Process p = r.exec("ls mnt");
            BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String inline;
            while ((inline = br.readLine()) != null) {
                if (inline.contains("mmcblk")) {
                    pre = inline;
                    break;
                }
            }
            br.close();
            root = "/mnt/" + pre + "/" + pre + "p1";
        } catch (Exception e) {

        }
        return root;
    }
}