Skip to content

Commit

Permalink
feat: save files to subfolder
Browse files Browse the repository at this point in the history
Downloaded files now would bw saved in the moeGramX subfolder in the downloads
  • Loading branch information
jplie committed Nov 13, 2023
1 parent 6b1ebbe commit bb88588
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
import org.thunderdog.challegram.ui.ListItem;
import org.thunderdog.challegram.ui.SettingsAdapter;
import org.thunderdog.challegram.util.Permissions;
import org.thunderdog.challegram.BuildConfig;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -260,7 +261,7 @@ private void navigateToPath (final View view, final String currentPath, final St
boolean downloadsEmpty = false;
if (context.permissions().canManageStorage()) {
try {
File file = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), BuildConfig.PROJECT_NAME);
if (file.exists() && file.isDirectory()) {
File[] files = file.listFiles();
if (files != null && !(downloadsEmpty = files.length == 0)) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/org/thunderdog/challegram/data/TD.java
Original file line number Diff line number Diff line change
Expand Up @@ -4536,7 +4536,7 @@ private static File saveToDownloadsImpl (final DownloadedFile file) {
break;
}
default: {
destDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
destDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), BuildConfig.PROJECT_NAME);
break;
}
}
Expand Down Expand Up @@ -4595,7 +4595,7 @@ private static void saveToDownloadsImpl (final File sourceFile, final String sou
if (!sourceFile.exists()) {
return;
}
final File destDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
final File destDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), BuildConfig.PROJECT_NAME);
if (!FileUtils.createDirectory(destDir)) {
return;
}
Expand Down

0 comments on commit bb88588

Please sign in to comment.