mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2025-12-04 15:49:33 +01:00
Use API for sdcard path.
This commit is contained in:
@@ -19,27 +19,32 @@
|
||||
*/
|
||||
package com.keepassdroid.tests.database;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Environment;
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
import com.keepassdroid.database.load.ImporterV3;
|
||||
import com.keepassdroid.tests.TestUtil;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.File;
|
||||
|
||||
public class Kdb3 extends AndroidTestCase {
|
||||
|
||||
private void testKeyfile(String dbAsset, String keyAsset, String password) throws Exception {
|
||||
Context ctx = getContext();
|
||||
|
||||
TestUtil.extractKey(ctx, keyAsset, "/sdcard/key");
|
||||
File sdcard = Environment.getExternalStorageDirectory();
|
||||
String keyPath = sdcard.getAbsolutePath() + "/key";
|
||||
|
||||
TestUtil.extractKey(ctx, keyAsset, keyPath);
|
||||
|
||||
AssetManager am = ctx.getAssets();
|
||||
InputStream is = am.open(dbAsset, AssetManager.ACCESS_STREAMING);
|
||||
|
||||
ImporterV3 importer = new ImporterV3();
|
||||
importer.openDatabase(is, password, "/sdcard/key");
|
||||
importer.openDatabase(is, password, keyPath);
|
||||
|
||||
is.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user