Skip to content

Commit

Permalink
Merge branch 'ikarus23:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
IIIef authored Dec 26, 2023
2 parents 6e7cf15 + 132fef7 commit ef5c7d1
Showing 1 changed file with 12 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -944,39 +944,19 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
* @see Common#copyFile(InputStream, OutputStream)
*/
private void copyStdKeysFiles() {
File std = Common.getFile(
Common.KEYS_DIR + "/" + Common.STD_KEYS);
File extended = Common.getFile(
Common.KEYS_DIR + "/" + Common.STD_KEYS_EXTENDED);
AssetManager assetManager = getAssets();

// Copy std.keys.
try {
InputStream in = assetManager.open(
Common.KEYS_DIR + "/" + Common.STD_KEYS);
OutputStream out = new FileOutputStream(std);
Common.copyFile(in, out);
in.close();
out.flush();
out.close();
} catch(IOException e) {
Log.e(LOG_TAG, "Error while copying 'std.keys' from assets "
+ "to internal storage.");
}

// Copy extended-std.keys.
try {
InputStream in = assetManager.open(
Common.KEYS_DIR + "/" + Common.STD_KEYS_EXTENDED);
OutputStream out = new FileOutputStream(extended);
Common.copyFile(in, out);
in.close();
out.flush();
out.close();
} catch(IOException e) {
Log.e(LOG_TAG, "Error while copying 'extended-std.keys' "
+ "from assets to internal storage.");
}

for (String file : assetManager.list(Common.KEYS_DIR)) {
String filePath = Common.KEYS_DIR + "/" + file;
InputStream in = assetManager.open(filePath);
OutputStream out = new FileOutputStream(Common.getFile(filePath));
Common.copyFile(in, out);
in.close();
out.flush();
out.close();
}
} catch(IOException e) {
Log.e(LOG_TAG, "Error while copying files from assets.");
}
}
}

0 comments on commit ef5c7d1

Please sign in to comment.