Skip to content

Commit 950837b

Browse files
authored
Merge pull request #349 from NordicSemiconductor/improvement/asset-path
Add asset path support
2 parents 0945d81 + 14b5488 commit 950837b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib_dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1478,7 +1478,9 @@ private InputStream openInputStream(@NonNull final String filePath, final String
14781478
*/
14791479
private InputStream openInputStream(@NonNull final Uri stream, final String mimeType, final int mbrSize, final int types)
14801480
throws IOException {
1481-
final InputStream is = getContentResolver().openInputStream(stream);
1481+
final InputStream is = stream.toString().startsWith("file:///android_asset/") ?
1482+
getAssets().open(stream.getPath().substring(15)) :
1483+
getContentResolver().openInputStream(stream);
14821484
assert is != null;
14831485
if (MIME_TYPE_ZIP.equals(mimeType))
14841486
return new ArchiveInputStream(is, mbrSize, types);

0 commit comments

Comments
 (0)