Skip to content

Commit

Permalink
Remove (now unnecessary) content URI to file URI conversion
Browse files Browse the repository at this point in the history
This caused issues at least on Android 13 and 14, additionally we now
actually display an error message when writing the file fails.

Fixes #2687
  • Loading branch information
simonpoole committed Sep 9, 2024
1 parent d4bf834 commit 90ab78b
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/main/java/de/blau/android/dialogs/ConsoleDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import de.blau.android.util.ReadFile;
import de.blau.android.util.SaveFile;
import de.blau.android.util.SavingHelper;
import de.blau.android.util.ScreenMessage;
import de.blau.android.util.SelectFile;
import de.blau.android.util.ThemeUtils;
import de.blau.android.util.Util;
Expand Down Expand Up @@ -264,11 +265,6 @@ public boolean save(FragmentActivity currentActivity, Uri fileUri) {
Log.e(DEBUG_TAG, "Restored fragment is null");
return false;
}
fileUri = FileUtil.contentUriToFileUri(currentActivity, fileUri);
if (fileUri == null) {
Log.e(DEBUG_TAG, "Couldn't convert " + fileUri);
return false;
}
writeScriptFile(currentActivity, fileUri, fragment.input.getText().toString(), null);
SelectFile.savePref(prefs, R.string.config_scriptsPreferredDir_key, fileUri);
return true;
Expand Down Expand Up @@ -354,6 +350,7 @@ protected Integer doInBackground(Void arg) {
} catch (IOException | IllegalArgumentException | IllegalStateException e) {
result = ErrorCodes.FILE_WRITE_FAILED;
Log.e(DEBUG_TAG, "Problem writing", e);
ScreenMessage.toastTopError(activity, activity.getString(R.string.toast_error_writing, e.getLocalizedMessage()), true);
}
return result;
}
Expand Down

0 comments on commit 90ab78b

Please sign in to comment.