mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Directory Bug (#1046)
The correct pattern to make a directory is: `if (!dir.mkdirs() && !dir.isDirectory()) { error }` mkdirs checks for exists so the exists check is redundant.
This commit is contained in:
parent
96d974f44d
commit
45d89bce80
|
@ -298,7 +298,7 @@ public final class HistoryManager {
|
||||||
static Uri saveHistory(String history) {
|
static Uri saveHistory(String history) {
|
||||||
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
File bsRoot = new File(Environment.getExternalStorageDirectory(), "BarcodeScanner");
|
||||||
File historyRoot = new File(bsRoot, "History");
|
File historyRoot = new File(bsRoot, "History");
|
||||||
if (!historyRoot.exists() && !historyRoot.mkdirs()) {
|
if (!historyRoot.mkdirs() && !historyRoot.isDirectory()) {
|
||||||
Log.w(TAG, "Couldn't make dir " + historyRoot);
|
Log.w(TAG, "Couldn't make dir " + historyRoot);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue