1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-01 16:51:16 +00:00

FileUtils: Move getExternalStorageDownloadsDirectory code into separate function

This commit is contained in:
Catfriend1 2019-02-24 13:19:18 +01:00
parent cc76014207
commit 4ef5853b88

View file

@ -115,8 +115,7 @@ public class FileUtils {
}
if (DOWNLOADS_VOLUME_NAME.equals(volumeId)) {
Log.v(TAG, "getVolumePath: isDownloadsVolume");
// Reading the environment var avoids hard coding the case of the "downloads" folder.
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
return getExternalStorageDownloadsDirectory();
}
StorageManager mStorageManager =
@ -237,6 +236,13 @@ public class FileUtils {
else return File.separator;
}
/**
* Reading the environment var avoids hard coding the absolute path of the "/Download" folder.
*/
public static String getExternalStorageDownloadsDirectory() {
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();
}
@Nullable
public static String cutTrailingSlash(final String path) {
if (path.endsWith(File.separator)) {