Skip to content

Commit

Permalink
Create folders if deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan01 committed May 19, 2020
1 parent 718637b commit b4cec07
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions app/src/main/java/wlfs/largefilesplitter/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@ protected void onPreExecute() {
protected Exception doInBackground(String... strings) {
String path = strings[0];
try {
File split_path = new File(SPLIT_FILE_PATH);
if(!split_path.exists()){
boolean success = split_path.mkdirs();
if(!success){
Toast.makeText(MainActivity.this,
"Unable to create directory to put files in",
Toast.LENGTH_SHORT).show();
return new Exception();
}
}
int counter = 0; // counts no of megabytes of data read
int num = 1; // output file prefix
File f = new File(path);
Expand Down Expand Up @@ -210,6 +220,16 @@ protected void onPreExecute() {
protected Exception doInBackground(String... strings) {
String path = strings[0];
try {
File join_path = new File(JOIN_FILE_PATH);
if(!join_path.exists()){
boolean success = join_path.mkdirs();
if (!success){
Toast.makeText(MainActivity.this,
"Unable to create directory for output file",
Toast.LENGTH_SHORT).show();
return new Exception();
}
}
int counter = 1; // counts no of megabytes of data read
File[] partfiles = getLFSPartFiles(path);
if(partfiles == null || partfiles.length < 1){
Expand Down

0 comments on commit b4cec07

Please sign in to comment.