Frage

Hi in my Filemanager i want to add an Option to rename Files in /system directory. Ive tried this to add to my code. It doesnt work. What did I wrong?

public static void renameRootTarget(String oldname, String name)
        throws IOException, InterruptedException {

    Process process = Runtime.getRuntime().exec("su");
    DataOutputStream out = new DataOutputStream(process.getOutputStream());
    out.writeBytes("mount -o remount rw /\n");
    out.writeBytes("mv /system/" +oldname + "/system/"+ name + "\n");
    out.writeBytes("exit\n");
    out.flush();
    process.waitFor();
}

oldname is the selected file and name is the new filename created with an EditText.

War es hilfreich?

Lösung

Change

out.writeBytes("mount -o remount rw /\n"); 

to

cmds.add("mount -o remount rw /system \n");
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top