CB-12964: (android) Fix of bug when Pictures folder did not exist.

If someone had removed Pictures folder in android, plugin failed trying to move there the new photo. This happened because plugin did not check the existence of this folder, and if not, it did not complete the folder tree.

This closes #273
This commit is contained in:
José Luis Ballesteros del Val 2017-06-28 16:38:45 +02:00 committed by Alexander Sorokin
parent f667ba6179
commit 3b8f64e330

View File

@ -601,6 +601,7 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
String imageFileName = "IMG_" + timeStamp + (this.encodingType == JPEG ? ".jpg" : ".png");
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
storageDir.mkdirs();
String galleryPath = storageDir.getAbsolutePath() + "/" + imageFileName;
return galleryPath;
}