Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
save dataDir; trivial log fix
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-bilibili committed Feb 14, 2022
1 parent 6729ebb commit 3c2aa1b
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.graphics.Color;
Expand Down Expand Up @@ -30,6 +31,7 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
Expand Down Expand Up @@ -394,7 +396,7 @@ private void saveUI() throws NullPointerException, JSONException {
for (Long index : cmdArgIdx) {
Editable[] oneOrTwoArgsEditable = cmdArgMap.get(index);
if (oneOrTwoArgsEditable == null) {
Log.e("ConfigActivity", "promptSaveAndApply encountered oneOrTwoArgs == null");
Log.e("ConfigActivity", "saveUI encountered oneOrTwoArgs == null");
throw new NullPointerException();
}
JSONArray oneOrTwoArgs = new JSONArray();
Expand Down Expand Up @@ -429,6 +431,13 @@ private void saveUI() throws NullPointerException, JSONException {
} else {
this.decodedPluginOptions.remove("legacyCfg");
}

// (not UI, but also saved here) save app data directory path
File dataDir = new ContextWrapper(getApplicationContext()).getFilesDir();
if (!dataDir.exists() && !dataDir.mkdirs()) {
Log.e("ConfigActivity", "dataDir.mkdirs() failed");
}
this.decodedPluginOptions.put("dataDir", dataDir.getAbsolutePath());
}
private void populateUI() throws JSONException {
// populate linearlayout_cmdargs
Expand Down

0 comments on commit 3c2aa1b

Please sign in to comment.