Skip to content

Commit

Permalink
ask before overwriting tree
Browse files Browse the repository at this point in the history
  • Loading branch information
androidlover5842 committed Aug 2, 2018
1 parent c75af57 commit 3b0b1cc
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/main/java/com/github/twrpbuilder/mkTree/MakeTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.File;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Scanner;

import static com.github.twrpbuilder.MainActivity.otg;

Expand Down Expand Up @@ -49,6 +50,19 @@ public MakeTree(boolean mtk, String type) {
System.exit(0);
}
}
if (new File(getPath()).exists())
{
System.out.println("Do you want to overwrite "+getPath()+" ?( default: n)");
Scanner read=new Scanner(System.in);
String in=read.nextLine();
if (!in.isEmpty() && in.equals("y"))
BuildMakeFiles();
else {
warnings();
Clean();
}
}
else
BuildMakeFiles();
}

Expand Down Expand Up @@ -83,13 +97,17 @@ public void run() {
MkBoardConfig();
}
System.out.println("Build fingerPrint: " + getFingerPrint());
System.out.println("tree ready for " + getCodename() +" at device"+seprator+getBrand()+seprator+getCodename());
System.out.println((char) 27 + "[31m" + "Warning :- Check recovery fstab before build" + (char) 27 + "[0m");
warnings();
Clean();
}
}).start();
}

private void warnings(){
System.out.println("tree ready for " + getCodename() +" at device"+seprator+getBrand()+seprator+getCodename());
System.out.println((char) 27 + "[31m" + "Warning :- Check recovery fstab before build" + (char) 27 + "[0m");
}

private void extractKernel(boolean mtk) {
mkdir(out);
if (AndroidImageKitchen) {
Expand Down

0 comments on commit 3b0b1cc

Please sign in to comment.